Feature Request: Approval to Implement /copy Command for Copying Last Result

Resolved 💬 2 comments Opened Aug 30, 2025 by satriadhikara Closed Nov 28, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What feature would you like to see?

I would like to implement a /copy command in Codex CLI that copies the last result of the conversation, similar to Gemini CLI and Claude Code. Requesting approval before starting development.

Are you interested in implementing this feature?

Yes

Additional information

This feature is present in Gemini CLI and Claude Code. It should work in TUI and terminal environments for easy copying of answers.

View original on GitHub ↗

2 Comments

angelcervera · 9 months ago

As a workaround, in the meantime, you can use this alias:

alias cpai='latest=$(ls -1t ~/.codex/sessions/**/*.jsonl(.N) 2>/dev/null | head -1); \
  if [ -z "$latest" ]; then echo "No Codex session logs found."; return 1; fi; \
  msg=$(jq -sr '\''reverse | map(select(.payload.role=="assistant" and .payload.type=="message") | [ .payload.content[]? | .text // empty ] | join("\n")) | .[0] // ""'\'' "$latest"); \
  if [ -z "$msg" ]; then echo "No assistant messages found in $latest."; return 1; fi; \
  printf "%s" "$msg" | xclip -selection clipboard && echo "Copied last reply to clipboard via xclip."'
etraut-openai contributor · 9 months ago

Thanks for the feature request. It has received only one upvote since it was opened three months ago, so I'm going to close it.