function cc --wraps='opencode --continue' --description 'opencode --continue (auto-starts tmux for visual subagent panes)'
    set -l port (python -c 'import socket; s=socket.socket(); s.bind(("127.0.0.1", 0)); print(s.getsockname()[1]); s.close()')

    if not set -q TMUX
        tmux new-session opencode --port $port --continue $argv
    else
        opencode --port $port --continue $argv
    end
end
