Skip to content

feat: auto-disable dynamic titles when Claude is invoked with --print #15

Description

@brianruggieri

Problem

--print puts Claude Code into non-interactive, single-turn mode — output goes to stdout, there's no TUI, and the session ends immediately. Dynamic pane titles are meaningless in this context: the monitor subshell starts, writes a welcome status, and then the session ends before any hooks fire.

Worse, CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1 (set by ccp) suppresses Claude's own title handling, but ccp's monitor is still running and writing OSC escapes to the terminal alongside Claude's stdout — potentially interleaving escape sequences with the piped output.

Proposed change

After the argument-parsing loop in bin/ccp, scan claude_args for --print (or -p if Claude supports it) and automatically set enable_dynamic=false:

# Auto-disable dynamic titles for non-interactive Claude invocations
for _arg in ${claude_args[@]+"${claude_args[@]}"}; do
    if [[ "${_arg}" == "--print" || "${_arg}" == "-p" ]]; then
        enable_dynamic=false
        break
    fi
done

This should run before the if [[ "${enable_dynamic}" = true ]] block that sets up hooks and starts the monitor, so the entire dynamic path is cleanly skipped — no monitor subshell, no hook injection, no state files.

Behaviour after change

# Non-interactive — dynamic titles silently disabled, clean stdout
ccp --print "Summarize this file"

# Interactive — dynamic titles active as normal  
ccp "Fix the auth bug"

No flag, no config, no warning needed — it's the obviously correct thing to do.

Also consider

--output-format json and --output-format stream-json are similarly non-interactive. These could be included in the same scan for completeness.

Files

  • bin/ccp — ~6 line scan after arg-parsing loop
  • tests/test-suite.sh — test that --print in args results in non-dynamic launch

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions