# Claude Code Teams

cmux claude-teams launches Claude Code with agent teams enabled. When Claude spawns teammate agents, they appear as native cmux splits instead of tmux panes, with full sidebar metadata and notifications.

## Usage

```
cmux claude-teams
cmux claude-teams --continue
cmux claude-teams --model sonnet
```

All arguments after claude-teams are forwarded to Claude Code. The command defaults teammate mode to auto and sets the environment so Claude uses cmux splits.

## How it works

cmux claude-teams creates a tmux shim script and configures the environment so Claude Code thinks it's running inside tmux. When Claude issues tmux commands to manage teammate panes, the shim translates them into cmux socket API calls.

-   สร้าง tmux shim ในไดเรกทอรี shim ชั่วคราวของ surface ปัจจุบัน พาธมี UUID ของ surface และเปลี่ยนไปในแต่ละพาเนลและแต่ละครั้งที่บูต จึงไม่สามารถระบุพาธตายตัวได้
-   ตั้งค่า TMUX และ TMUX\_PANE เพื่อจำลอง tmux สำหรับเซสชันที่เปิดใช้ Claude Teams
-   Prepends the shim directory to PATH so Claude finds the shim before real tmux
-   Enables CLAUDE\_CODE\_EXPERIMENTAL\_AGENT\_TEAMS=1 and sets teammate mode to auto

shim จะกำหนดเส้นทางไปยัง cmux เฉพาะเมื่อมีการตั้งค่า `CMUX_CLAUDE_TEAMS_CMUX_BIN` เท่านั้น หากไม่ได้ตั้งค่า จะส่งต่ออย่างโปร่งใสไปยังไฟล์ปฏิบัติการ tmux จริงตัวถัดไป ดังนั้น `which tmux` จึงไม่บอกว่าการดักจับของ Claude Teams เปิดใช้งานอยู่หรือไม่

## Environment variables

| Variable | Purpose |
| --- | --- |
| `TMUX` | พาธ socket tmux แบบสังเคราะห์สำหรับเซสชันที่รัน cmux claude-teams |
| `TMUX_PANE` | ตัวระบุ pane tmux แบบสังเคราะห์สำหรับเซสชันที่รัน cmux claude-teams; ว่างในพาเนล agent ที่สร้างขึ้น |
| `CMUX_SURFACE_ID` | UUID ของ surface ปัจจุบัน ใช้ค่านี้เป็นตัวระบุ surface ภายในพาเนล agent ที่สร้างขึ้น |
| `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` | Enables Claude Code agent teams feature |
| `CMUX_SOCKET_PATH` | Path to the cmux control socket for the shim to connect to |

ค่า `TMUX`, `TMUX_PANE` แบบสังเคราะห์และค่าความเข้ากันได้กับ tmux ที่เกี่ยวข้อง อธิบายเซสชันที่รัน `cmux claude-teams` ไม่ใช่พาเนลที่สร้างขึ้น จากพาเนล agent ให้ใช้ `CMUX_SURFACE_ID` และรัน `cmux tree --json` โดยอ็อบเจ็กต์ `caller` ในผลลัพธ์จะระบุพาเนลที่เรียกคำสั่ง

## Directories

| Path | Purpose |
| --- | --- |
| ไดเรกทอรีสำหรับแต่ละ surface ภายใต้ไดเรกทอรีชั่วคราวของระบบ (ไม่มีพาธตายตัว) | มี tmux shim ที่ใช้งานอยู่และถูกเพิ่มไว้หน้าสุดของ PATH สำหรับ surface นั้น |
| `~/.cmuxterm/tmux-compat-store.json` | พื้นที่จัดเก็บถาวรสำหรับ buffer, hook และสถานะการจัดวาง/เลย์เอาต์ split ของ tmux-compat |

คีย์สำหรับ routing ของการแบ่งพาเนลมีดังนี้:

-   `lastSplitSurface` — จับคู่ UUID ของแต่ละ workspace กับ UUID ของ surface ที่สร้างจากการแบ่งล่าสุด ใช้ตั้งค่า anchor ของคอลัมน์ agent ซึ่งกำหนดว่าการแบ่งแบบ main-vertical ครั้งถัดไปจะไปอยู่ที่ใด
-   `mainVerticalLayouts` — จับคู่ UUID ของแต่ละ workspace กับ `mainSurfaceId` (surface หลักหรือ leader) และ `lastColumnSurfaceId` (surface ล่างสุดในคอลัมน์ agent) การแบ่งของเพื่อนร่วมทีมครั้งต่อไปจะใช้คอลัมน์นี้เป็นเป้าหมายและเรียงลงด้านล่าง

ตรวจสอบคีย์ routing เหล่านี้เมื่อพาเนลของเพื่อนร่วมทีมปรากฏเป็นแท็บด้านหลัง surface ที่มีอยู่ แทนที่จะเป็นการแบ่งอยู่ข้าง ๆ กัน

## Supported tmux commands

The shim translates these tmux commands into cmux operations:

-   `new-session`, `new-window` → creates a new cmux workspace
-   `split-window` → splits the current cmux pane
-   `send-keys` → sends text to a cmux surface
-   `capture-pane` → reads terminal text from a cmux surface
-   `select-pane`, `select-window` → focuses a cmux pane or workspace
-   `kill-pane`, `kill-window` → closes a cmux surface or workspace
-   `list-panes`, `list-windows` → lists cmux panes or workspaces

Canonical: https://cmux.com/th/docs/agent-integrations/claude-code-teams

Documentation index: https://cmux.com/llms.txt
