Skip to content

Command Code overwrites its process name with the terminal title #764

Closed

Description

@ogulcancelik

Summary

I maintain Herdr, a terminal runtime that detects coding agents from the foreground process.

I’m trying to add Command Code support, but Command Code replaces its process name and command line with the current terminal title. That title changes with the project or session, so there is no stable name Herdr can detect.

Expected Behavior

Command Code should keep a stable process name such as command-code. The terminal tab title can still show the project or session name through the normal OSC escape sequence.

Actual Behavior

I launched Command Code with command-code. Once the UI started, Linux reported:

comm:    ⌘ Command Cod
cmdline: ⌘ Command Code · review-pr-3332-command-code
exe:     /home/can/.local/share/fnm/node-versions/v24.15.0/installation/bin/node

The original command and node_modules/command-code/dist/index.mjs path are both gone. Linux truncates the changing title even further in comm.

The published package appears to couple the terminal title and process title:

function writeTitle(title) {
  setProcessTitle(title)
  process.stderr.isTTY && process.stderr.write(oscTitle(title))
}

Steps to reproduce the issue

  1. Start Command Code on Linux:

    command-code
  2. From another terminal, inspect the process:

    pid=$(pgrep -n -f 'Command Code ·')
    ps -p "$pid" -o comm=,args=
    tr '\0' ' ' < "/proc/$pid/cmdline"
    readlink "/proc/$pid/exe"
  3. The process name and command line now contain the changing terminal title instead of a stable Command Code identity.

Command Code Version

1.38.1

Operating System

Linux

Terminal/IDE

Ghostty, running through Herdr

Shell

zsh

Additional context

The npm aliases cmd, cmdc, command-code, and commandcode all end up with the same changing process title.

Could you keep process.title stable as command-code, or stop changing it? The terminal title can continue changing independently. Without a stable process identity, I can’t add reliable Command Code detection to Herdr.

More generally, using a changing terminal title as the process identity makes Command Code harder to inspect, monitor, and integrate with using standard CLI tooling such as ps, top, and process supervisors.

Activity

  1. vipulgupta2048 commented on Sep 2, 2026

    @vipulgupta2048
    Contributor

    Hello, @ogulcancelik Thanks for reaching out. Cool to see Command Code being added to Herdr. I am working on this right now. Any other blockers you see with integrating Command Code?

  2. abuamar142 commented on Sep 7, 2026

    @abuamar142

    Additional data point from an end-to-end test (Command Code v1.50.0, Herdr 0.8.2 patched build, Linux), in case it helps the fix:

    I ran Command Code in a Herdr pane and watched process identity over time:

    1. During startup / -p (print) mode, the process is node /usr/bin/cmd ... — a normal node wrapper. A tool that inspects argv (or resolves the /usr/bin/cmd symlink to node_modules/command-code/dist/index.mjs) can identify it.
    2. Once the TUI is up, process.title overwrite kicks in and both comm and /proc/<pid>/cmdline become the changing title (⌘ Command Code · <model>; comm truncated to 15 chars). The original argv is gone, so path/argv-based detection stops working mid-session.

    So the window where process-based detection works is only startup and non-interactive runs. For a running TUI session, the process itself has to volunteer its identity.

    One cheap option that requires no Herdr change: Herdr already reads a HERDR_AGENT=<agent> env hint from /proc/<pid>/environ (docs: "Set HERDR_AGENT= on the wrapper command to tell Herdr which existing agent screen manifest to use"). If Command Code sets HERDR_AGENT=command-code in its own environment whenever it detects HERDR_ENV=1 / HERDR_SOCKET_PATH in its parent environment, Herdr can keep treating the pane as Command Code for the whole session even after the process title is overwritten. The terminal title can keep changing freely.

    Keeping process.title stable (e.g. command-code) would also work and is more generally useful for ps/supervisors, but the env hint is the minimal integration surface.

  3. vipulgupta2048 commented on Sep 10, 2026

    @vipulgupta2048
    Contributor

    Hello @ogulcancelik changes have been shipped to v1.50.1 - https://commandcode.ai/changelog#v1.50.1
    I even shipped wiring to allow herdr to parse Command Code idle/busy states

    Please reach out if you need more help

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions