Skip to content

Remove leading two-space indent from prompts #8258

Closed

Description

@PaulRBerg

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

Activity

  1. added
    enhancement
    CLI
    on Dec 18, 2025
  2. simonallfrey commented on Dec 29, 2025

    @simonallfrey

    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)

  3. robin-liquidium commented on Jan 3, 2026

    @robin-liquidium

    yes this should exist as a feature flag

  4. pgibler commented on Feb 8, 2026

    @pgibler

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

  5. emilan commented on Feb 18, 2026

    @emilan

    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'

  6. totoroot commented on Feb 24, 2026

    @totoroot

    @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'
  7. ZaDarkSide commented on Mar 22, 2026

    @ZaDarkSide

    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 🤦‍♂️

  8. added
    TUI
    and removed
    CLI
    on Mar 22, 2026
  9. verhovsky commented on Apr 8, 2026

    @verhovsky
    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

  10. bduffany commented on Apr 9, 2026

    @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.

  11. ZaDarkSide commented on Apr 9, 2026

    @ZaDarkSide

    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

  12. dhaern commented on Apr 11, 2026

    @dhaern

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

    #16431 (comment)

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

  13. changed the title [-][FEATURE] Remove leading two-space indent from prompts[/-] [+]Remove leading two-space indent from prompts[/+] on May 31, 2026
  14. etraut-openai commented on Oct 12, 2026

    @etraut-openai
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    TUIenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions