Skip to content

Feature request: Per-session mode isolation for tmux users #334

@Tarek98

Description

@Tarek98

Hello there, this is a feature I'd love to see implemented for caveman as I really like using it in claude code but would love different tmux panes to use different modes. All of the below is the problem description & proposed solution written by Claude Code:

Problem

When running multiple Claude Code sessions in tmux panes, all
sessions share a
single flag file (~/.claude/.caveman-active). Running /caveman ultra in one
pane silently changes the mode in every other pane.

Root Cause

caveman-mode-tracker.js and caveman-activate.js both resolve
flagPath as:

const flagPath = path.join(claudeDir, '.caveman-active');

Single global file, no per-session discrimination.

Proposed Fix

Key flag file by $TMUX_PANE (e.g. %0, %1) when inside tmux:

// caveman-config.js
function getFlagPath(claudeDir) {
const base = path.join(claudeDir, '.caveman-active');
const pane = process.env.TMUX_PANE;
if (pane) {
const safe = pane.replace(/[^a-zA-Z0-9%]/g, '');
if (safe) return base + '-' + safe;
}
return base;
}

Replace hardcoded flagPath in caveman-mode-tracker.js and
caveman-activate.js
with getFlagPath(claudeDir). Same treatment for
caveman-statusline.sh with
a fallback to the global flag if pane-specific file doesn't
exist.

Behavior After Fix

  • Each tmux pane gets its own flag (.caveman-active-%0,
    .caveman-active-%1)
  • /caveman ultra in pane 1 does not affect pane 2
  • Non-tmux sessions fall back to .caveman-active (unchanged
    behavior)
  • $CAVEMAN_DEFAULT_MODE still works as per-pane override at
    launch time

Environment

macOS, tmux, multiple Claude Code sessions per window

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions