This gives each cmux terminal its own persistent zsh or Bash history file. The key is CMUX_SURFACE_ID, which identifies the terminal surface. Do not key this by CMUX_WORKSPACE_ID: a workspace can contain multiple terminals, and workspace identity is not the right granularity for command history.
Copy this prompt into your coding agent:
I use cmux on macOS and want the Up/Down arrows in each terminal to show only commands from that terminal. The history must survive cmux quit/reopen and a normal computer restart.