codingbuddy-rules 4.4.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ai-rules/adapters/antigravity.md +6 -6
- package/.ai-rules/adapters/claude-code.md +107 -4
- package/.ai-rules/adapters/codex.md +5 -5
- package/.ai-rules/adapters/cursor.md +2 -2
- package/.ai-rules/adapters/kiro.md +8 -8
- package/.ai-rules/adapters/opencode.md +7 -7
- package/.ai-rules/adapters/q.md +2 -2
- package/.ai-rules/agents/README.md +66 -16
- package/.ai-rules/agents/accessibility-specialist.json +2 -1
- package/.ai-rules/agents/act-mode.json +2 -1
- package/.ai-rules/agents/agent-architect.json +8 -7
- package/.ai-rules/agents/ai-ml-engineer.json +1 -0
- package/.ai-rules/agents/architecture-specialist.json +1 -0
- package/.ai-rules/agents/auto-mode.json +4 -2
- package/.ai-rules/agents/backend-developer.json +1 -0
- package/.ai-rules/agents/code-quality-specialist.json +1 -0
- package/.ai-rules/agents/code-reviewer.json +65 -64
- package/.ai-rules/agents/data-engineer.json +8 -7
- package/.ai-rules/agents/data-scientist.json +10 -9
- package/.ai-rules/agents/devops-engineer.json +1 -0
- package/.ai-rules/agents/documentation-specialist.json +1 -0
- package/.ai-rules/agents/eval-mode.json +20 -19
- package/.ai-rules/agents/event-architecture-specialist.json +1 -0
- package/.ai-rules/agents/frontend-developer.json +1 -0
- package/.ai-rules/agents/i18n-specialist.json +2 -1
- package/.ai-rules/agents/integration-specialist.json +1 -0
- package/.ai-rules/agents/migration-specialist.json +1 -0
- package/.ai-rules/agents/mobile-developer.json +8 -7
- package/.ai-rules/agents/observability-specialist.json +1 -0
- package/.ai-rules/agents/parallel-orchestrator.json +346 -0
- package/.ai-rules/agents/performance-specialist.json +1 -0
- package/.ai-rules/agents/plan-mode.json +3 -1
- package/.ai-rules/agents/plan-reviewer.json +208 -0
- package/.ai-rules/agents/platform-engineer.json +1 -0
- package/.ai-rules/agents/security-engineer.json +9 -8
- package/.ai-rules/agents/security-specialist.json +2 -1
- package/.ai-rules/agents/seo-specialist.json +1 -0
- package/.ai-rules/agents/software-engineer.json +1 -0
- package/.ai-rules/agents/solution-architect.json +11 -10
- package/.ai-rules/agents/systems-developer.json +9 -8
- package/.ai-rules/agents/technical-planner.json +11 -10
- package/.ai-rules/agents/test-engineer.json +7 -6
- package/.ai-rules/agents/test-strategy-specialist.json +1 -0
- package/.ai-rules/agents/tooling-engineer.json +4 -3
- package/.ai-rules/agents/ui-ux-designer.json +1 -0
- package/.ai-rules/keyword-modes.json +4 -4
- package/.ai-rules/rules/clarification-guide.md +14 -14
- package/.ai-rules/rules/core.md +90 -1
- package/.ai-rules/rules/parallel-execution.md +217 -0
- package/.ai-rules/skills/README.md +23 -1
- package/.ai-rules/skills/agent-design/SKILL.md +5 -0
- package/.ai-rules/skills/agent-design/examples/agent-template.json +58 -0
- package/.ai-rules/skills/agent-design/references/expertise-guidelines.md +112 -0
- package/.ai-rules/skills/agent-discussion/SKILL.md +199 -0
- package/.ai-rules/skills/agent-discussion-panel/SKILL.md +448 -0
- package/.ai-rules/skills/api-design/SKILL.md +5 -0
- package/.ai-rules/skills/api-design/examples/error-response.json +159 -0
- package/.ai-rules/skills/api-design/examples/openapi-template.yaml +393 -0
- package/.ai-rules/skills/build-fix/SKILL.md +234 -0
- package/.ai-rules/skills/code-explanation/SKILL.md +4 -0
- package/.ai-rules/skills/context-management/SKILL.md +1 -0
- package/.ai-rules/skills/cost-budget/SKILL.md +348 -0
- package/.ai-rules/skills/cross-repo-issues/SKILL.md +257 -0
- package/.ai-rules/skills/database-migration/SKILL.md +1 -0
- package/.ai-rules/skills/deepsearch/SKILL.md +214 -0
- package/.ai-rules/skills/deployment-checklist/SKILL.md +1 -0
- package/.ai-rules/skills/error-analysis/SKILL.md +1 -0
- package/.ai-rules/skills/finishing-a-development-branch/SKILL.md +281 -0
- package/.ai-rules/skills/frontend-design/SKILL.md +5 -0
- package/.ai-rules/skills/frontend-design/examples/component-template.tsx +203 -0
- package/.ai-rules/skills/frontend-design/references/css-patterns.md +243 -0
- package/.ai-rules/skills/git-master/SKILL.md +358 -0
- package/.ai-rules/skills/incident-response/SKILL.md +1 -0
- package/.ai-rules/skills/legacy-modernization/SKILL.md +1 -0
- package/.ai-rules/skills/mcp-builder/SKILL.md +7 -0
- package/.ai-rules/skills/mcp-builder/examples/resource-example.ts +233 -0
- package/.ai-rules/skills/mcp-builder/examples/tool-example.ts +203 -0
- package/.ai-rules/skills/mcp-builder/references/protocol-spec.md +215 -0
- package/.ai-rules/skills/performance-optimization/SKILL.md +3 -0
- package/.ai-rules/skills/plan-and-review/SKILL.md +115 -0
- package/.ai-rules/skills/pr-all-in-one/SKILL.md +15 -13
- package/.ai-rules/skills/pr-all-in-one/configuration-guide.md +7 -7
- package/.ai-rules/skills/pr-all-in-one/pr-templates.md +10 -10
- package/.ai-rules/skills/pr-review/SKILL.md +4 -0
- package/.ai-rules/skills/receiving-code-review/SKILL.md +347 -0
- package/.ai-rules/skills/refactoring/SKILL.md +1 -0
- package/.ai-rules/skills/requesting-code-review/SKILL.md +348 -0
- package/.ai-rules/skills/rule-authoring/SKILL.md +5 -0
- package/.ai-rules/skills/rule-authoring/examples/rule-template.md +142 -0
- package/.ai-rules/skills/rule-authoring/examples/trigger-patterns.md +126 -0
- package/.ai-rules/skills/security-audit/SKILL.md +4 -0
- package/.ai-rules/skills/skill-creator/SKILL.md +461 -0
- package/.ai-rules/skills/skill-creator/agents/analyzer.md +206 -0
- package/.ai-rules/skills/skill-creator/agents/comparator.md +167 -0
- package/.ai-rules/skills/skill-creator/agents/grader.md +152 -0
- package/.ai-rules/skills/skill-creator/assets/eval_review.html +289 -0
- package/.ai-rules/skills/skill-creator/assets/skill-template.md +43 -0
- package/.ai-rules/skills/skill-creator/eval-viewer/generate_review.py +496 -0
- package/.ai-rules/skills/skill-creator/references/frontmatter-guide.md +632 -0
- package/.ai-rules/skills/skill-creator/references/multi-tool-compat.md +480 -0
- package/.ai-rules/skills/skill-creator/references/schemas.md +784 -0
- package/.ai-rules/skills/skill-creator/scripts/aggregate_benchmark.py +302 -0
- package/.ai-rules/skills/skill-creator/scripts/init_skill.sh +196 -0
- package/.ai-rules/skills/skill-creator/scripts/run_loop.py +327 -0
- package/.ai-rules/skills/systematic-debugging/SKILL.md +1 -0
- package/.ai-rules/skills/tech-debt/SKILL.md +1 -0
- package/.ai-rules/skills/test-coverage-gate/SKILL.md +303 -0
- package/.ai-rules/skills/tmux-master/SKILL.md +491 -0
- package/.ai-rules/skills/using-git-worktrees/SKILL.md +368 -0
- package/.ai-rules/skills/verification-before-completion/SKILL.md +234 -0
- package/.ai-rules/skills/widget-slot-architecture/SKILL.md +6 -0
- package/.ai-rules/skills/widget-slot-architecture/examples/parallel-route-setup.tsx +206 -0
- package/.ai-rules/skills/widget-slot-architecture/examples/widget-component.tsx +250 -0
- package/.ai-rules/skills/writing-plans/SKILL.md +78 -0
- package/bin/cli.js +178 -0
- package/lib/init/detect-stack.js +148 -0
- package/lib/init/generate-config.js +31 -0
- package/lib/init/index.js +86 -0
- package/lib/init/prompt.js +60 -0
- package/lib/init/scaffold.js +67 -0
- package/lib/init/suggest-agent.js +46 -0
- package/package.json +10 -2
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tmux-master
|
|
3
|
+
description: >-
|
|
4
|
+
Background knowledge for tmux session, window, and pane lifecycle management,
|
|
5
|
+
layout control, inter-pane communication, styling, and troubleshooting.
|
|
6
|
+
Used by taskMaestro and parallel execution workflows.
|
|
7
|
+
user-invocable: false
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# tmux Master
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
tmux is the backbone of parallel AI agent execution. Misconfigured sessions cause orphaned processes, lost output, and silent failures that waste entire execution waves.
|
|
15
|
+
|
|
16
|
+
**Core principle:** Every tmux operation must be targeted to a specific session, window, or pane by ID — never rely on "current" context in automated workflows.
|
|
17
|
+
|
|
18
|
+
**Violating the letter of this process is violating the spirit of reliable automation.**
|
|
19
|
+
|
|
20
|
+
## The Iron Law
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
ALWAYS USE EXPLICIT TARGETS (-t session:window.pane). NEVER ASSUME CONTEXT.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Automated workflows run outside interactive shells. `tmux` commands without `-t` targets silently operate on the wrong pane or fail entirely. There are no exceptions.
|
|
27
|
+
|
|
28
|
+
**No exceptions:**
|
|
29
|
+
- "The session is obvious" → Explicit `-t` anyway
|
|
30
|
+
- "There's only one pane" → Panes get added; target explicitly
|
|
31
|
+
- "I'll fix the target later" → Fix it now; debugging wrong-pane issues is expensive
|
|
32
|
+
|
|
33
|
+
## When to Use
|
|
34
|
+
|
|
35
|
+
This skill provides background knowledge for ANY tmux operation:
|
|
36
|
+
- Creating sessions, windows, or panes for parallel agents
|
|
37
|
+
- Managing layouts for multi-pane orchestration
|
|
38
|
+
- Sending commands to panes programmatically
|
|
39
|
+
- Polling pane output for readiness or completion
|
|
40
|
+
- Styling panes for visual differentiation
|
|
41
|
+
- Debugging tmux-related failures in CI or automation
|
|
42
|
+
|
|
43
|
+
**Relevant contexts:**
|
|
44
|
+
- taskMaestro wave execution with multiple parallel panes
|
|
45
|
+
- AI agent orchestration requiring isolated terminal environments
|
|
46
|
+
- Any workflow that spawns, monitors, or communicates with tmux panes
|
|
47
|
+
|
|
48
|
+
## When NOT to Use
|
|
49
|
+
|
|
50
|
+
- **Interactive tmux usage** — Manual terminal multiplexing needs no formal process
|
|
51
|
+
- **Single-pane workflows** — If you only need one terminal, tmux adds no value
|
|
52
|
+
- **Docker/container orchestration** — Use container tools, not tmux, for process isolation
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Phase 1: Session, Window, and Pane Lifecycle
|
|
57
|
+
|
|
58
|
+
### 1.1 Session Management
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Create a named session (detached)
|
|
62
|
+
tmux new-session -d -s "my-session"
|
|
63
|
+
|
|
64
|
+
# Create session with a specific starting directory
|
|
65
|
+
tmux new-session -d -s "my-session" -c "/path/to/project"
|
|
66
|
+
|
|
67
|
+
# List all sessions
|
|
68
|
+
tmux list-sessions
|
|
69
|
+
|
|
70
|
+
# Kill a specific session
|
|
71
|
+
tmux kill-session -t "my-session"
|
|
72
|
+
|
|
73
|
+
# Kill ALL sessions (use with caution)
|
|
74
|
+
tmux kill-server
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 1.2 Window Management
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Create a new window in an existing session
|
|
81
|
+
tmux new-window -t "my-session" -n "build"
|
|
82
|
+
|
|
83
|
+
# Rename a window
|
|
84
|
+
tmux rename-window -t "my-session:0" "conductor"
|
|
85
|
+
|
|
86
|
+
# List windows
|
|
87
|
+
tmux list-windows -t "my-session"
|
|
88
|
+
|
|
89
|
+
# Close a window
|
|
90
|
+
tmux kill-window -t "my-session:build"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 1.3 Pane Management
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Split horizontally (top/bottom)
|
|
97
|
+
tmux split-window -t "my-session:0" -v
|
|
98
|
+
|
|
99
|
+
# Split vertically (left/right)
|
|
100
|
+
tmux split-window -t "my-session:0" -h
|
|
101
|
+
|
|
102
|
+
# Split with a specific starting directory
|
|
103
|
+
tmux split-window -t "my-session:0" -v -c "/path/to/worktree"
|
|
104
|
+
|
|
105
|
+
# List panes with their IDs
|
|
106
|
+
tmux list-panes -t "my-session:0" -F '#{pane_index}: #{pane_id} #{pane_current_command}'
|
|
107
|
+
|
|
108
|
+
# Kill a specific pane
|
|
109
|
+
tmux kill-pane -t "my-session:0.2"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 1.4 Multi-Pane Creation Pattern (taskMaestro)
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
SESSION="taskmaestro-$(date +%s)"
|
|
116
|
+
PANE_COUNT=4
|
|
117
|
+
|
|
118
|
+
tmux new-session -d -s "$SESSION" -c "$PROJECT_ROOT"
|
|
119
|
+
|
|
120
|
+
for i in $(seq 1 $((PANE_COUNT - 1))); do
|
|
121
|
+
tmux split-window -t "$SESSION:0" -v -c "$PROJECT_ROOT"
|
|
122
|
+
done
|
|
123
|
+
|
|
124
|
+
# Rebalance after all splits
|
|
125
|
+
tmux select-layout -t "$SESSION:0" tiled
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Good vs Bad:**
|
|
129
|
+
|
|
130
|
+
| | Example | Why |
|
|
131
|
+
|---|---------|-----|
|
|
132
|
+
| **Good** | `tmux split-window -t "$SESSION:0" -v -c "$WT_DIR"` | Explicit target, explicit directory |
|
|
133
|
+
| **Bad** | `tmux split-window` | No target, no directory — operates on whatever is "current" |
|
|
134
|
+
| **Good** | `tmux kill-pane -t "$SESSION:0.3"` | Targets exact pane |
|
|
135
|
+
| **Bad** | `tmux kill-pane` | Kills whichever pane happens to be selected |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Phase 2: Layout Management
|
|
140
|
+
|
|
141
|
+
### 2.1 Built-in Layouts
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Apply a preset layout
|
|
145
|
+
tmux select-layout -t "$SESSION:0" even-horizontal
|
|
146
|
+
tmux select-layout -t "$SESSION:0" even-vertical
|
|
147
|
+
tmux select-layout -t "$SESSION:0" main-horizontal
|
|
148
|
+
tmux select-layout -t "$SESSION:0" main-vertical
|
|
149
|
+
tmux select-layout -t "$SESSION:0" tiled
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### 2.2 Manual Resize
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Resize pane by cell count
|
|
156
|
+
tmux resize-pane -t "$SESSION:0.1" -D 10 # down 10 rows
|
|
157
|
+
tmux resize-pane -t "$SESSION:0.1" -U 5 # up 5 rows
|
|
158
|
+
tmux resize-pane -t "$SESSION:0.1" -R 20 # right 20 columns
|
|
159
|
+
tmux resize-pane -t "$SESSION:0.1" -L 10 # left 10 columns
|
|
160
|
+
|
|
161
|
+
# Resize to exact percentage
|
|
162
|
+
tmux resize-pane -t "$SESSION:0.0" -y 25% # 25% of window height
|
|
163
|
+
tmux resize-pane -t "$SESSION:0.0" -x 50% # 50% of window width
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 2.3 Swap Panes
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Swap two panes by index
|
|
170
|
+
tmux swap-pane -s "$SESSION:0.0" -t "$SESSION:0.2"
|
|
171
|
+
|
|
172
|
+
# Move current pane up/down in order
|
|
173
|
+
tmux swap-pane -t "$SESSION:0.1" -U
|
|
174
|
+
tmux swap-pane -t "$SESSION:0.1" -D
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### 2.4 Conductor-Bottom Layout Pattern
|
|
178
|
+
|
|
179
|
+
The conductor pane (orchestrator) sits at the bottom, worker panes fill the top:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
LAST_PANE=$((PANE_COUNT - 1))
|
|
183
|
+
|
|
184
|
+
# Conductor is pane 0 initially; swap it to the last position
|
|
185
|
+
tmux swap-pane -s "$SESSION:0.0" -t "$SESSION:0.$LAST_PANE"
|
|
186
|
+
|
|
187
|
+
# Resize the conductor (now at bottom) to 25% height
|
|
188
|
+
tmux resize-pane -t "$SESSION:0.$LAST_PANE" -y 25%
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
This produces:
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
┌──────────┬──────────┬──────────┐
|
|
195
|
+
│ Worker 1 │ Worker 2 │ Worker 3 │ 75%
|
|
196
|
+
├──────────┴──────────┴──────────┤
|
|
197
|
+
│ Conductor │ 25%
|
|
198
|
+
└────────────────────────────────┘
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Phase 3: Pane Communication
|
|
204
|
+
|
|
205
|
+
### 3.1 Sending Commands
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Send a command to a specific pane
|
|
209
|
+
tmux send-keys -t "$SESSION:0.1" "cd /path/to/worktree && yarn test" Enter
|
|
210
|
+
|
|
211
|
+
# Send literal text (no Enter)
|
|
212
|
+
tmux send-keys -t "$SESSION:0.1" "echo hello"
|
|
213
|
+
|
|
214
|
+
# Send special keys
|
|
215
|
+
tmux send-keys -t "$SESSION:0.1" C-c # Ctrl+C (interrupt)
|
|
216
|
+
tmux send-keys -t "$SESSION:0.1" C-l # Ctrl+L (clear screen)
|
|
217
|
+
tmux send-keys -t "$SESSION:0.1" Enter # Press Enter
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### 3.2 Capturing Output
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# Capture visible pane content
|
|
224
|
+
tmux capture-pane -t "$SESSION:0.1" -p
|
|
225
|
+
|
|
226
|
+
# Capture with scrollback history (last 1000 lines)
|
|
227
|
+
tmux capture-pane -t "$SESSION:0.1" -p -S -1000
|
|
228
|
+
|
|
229
|
+
# Capture to a file
|
|
230
|
+
tmux capture-pane -t "$SESSION:0.1" -p > /tmp/pane-output.txt
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### 3.3 Readiness Polling
|
|
234
|
+
|
|
235
|
+
Wait for a pane to be ready (shell prompt visible) before sending commands:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
PANE="$SESSION:0.1"
|
|
239
|
+
MAX_WAIT=30
|
|
240
|
+
ELAPSED=0
|
|
241
|
+
|
|
242
|
+
while [ $ELAPSED -lt $MAX_WAIT ]; do
|
|
243
|
+
# Check for common shell prompt indicators
|
|
244
|
+
if tmux capture-pane -t "$PANE" -p | grep -qE '⏵⏵|❯|\$\s*$'; then
|
|
245
|
+
echo "Pane $PANE is ready"
|
|
246
|
+
break
|
|
247
|
+
fi
|
|
248
|
+
sleep 1
|
|
249
|
+
ELAPSED=$((ELAPSED + 1))
|
|
250
|
+
done
|
|
251
|
+
|
|
252
|
+
if [ $ELAPSED -ge $MAX_WAIT ]; then
|
|
253
|
+
echo "ERROR: Pane $PANE not ready after ${MAX_WAIT}s"
|
|
254
|
+
exit 1
|
|
255
|
+
fi
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Prompt patterns to detect:**
|
|
259
|
+
|
|
260
|
+
| Shell / Tool | Pattern |
|
|
261
|
+
|-------------|---------|
|
|
262
|
+
| bash/zsh default | `$` or `%` at end of line |
|
|
263
|
+
| Starship / Powerline | `❯` or `⏵⏵` |
|
|
264
|
+
| Claude Code | `❯` or `⏵⏵` |
|
|
265
|
+
| Custom PS1 | Project-specific — adapt the grep pattern |
|
|
266
|
+
|
|
267
|
+
### 3.4 Completion Polling
|
|
268
|
+
|
|
269
|
+
Wait for a long-running command to finish:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
PANE="$SESSION:0.1"
|
|
273
|
+
|
|
274
|
+
# Poll until the shell prompt returns (command finished)
|
|
275
|
+
while ! tmux capture-pane -t "$PANE" -p | tail -5 | grep -qE '⏵⏵|❯|\$\s*$'; do
|
|
276
|
+
sleep 2
|
|
277
|
+
done
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Phase 4: Styling
|
|
283
|
+
|
|
284
|
+
### 4.1 Pane Background Colors
|
|
285
|
+
|
|
286
|
+
Differentiate panes visually by role:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
# Set pane background color
|
|
290
|
+
tmux select-pane -t "$SESSION:0.0" -P 'bg=#1a1a2e' # deep blue — conductor
|
|
291
|
+
tmux select-pane -t "$SESSION:0.1" -P 'bg=#1a2e1a' # deep green — worker 1
|
|
292
|
+
tmux select-pane -t "$SESSION:0.2" -P 'bg=#2e1a1a' # deep red — worker 2
|
|
293
|
+
tmux select-pane -t "$SESSION:0.3" -P 'bg=#2e2e1a' # deep yellow — worker 3
|
|
294
|
+
|
|
295
|
+
# Reset pane style to default
|
|
296
|
+
tmux select-pane -t "$SESSION:0.0" -P 'default'
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### 4.2 Pane Border Styling
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
# Set pane border style (tmux 3.2+)
|
|
303
|
+
tmux set-option -t "$SESSION" pane-border-style 'fg=#444444'
|
|
304
|
+
tmux set-option -t "$SESSION" pane-active-border-style 'fg=#00aaff'
|
|
305
|
+
|
|
306
|
+
# Show pane border labels (tmux 3.4+)
|
|
307
|
+
tmux set-option -t "$SESSION" pane-border-status top
|
|
308
|
+
tmux set-option -t "$SESSION" pane-border-format ' #{pane_index}: #{pane_title} '
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### 4.3 Setting Pane Titles
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
# Set a pane title for identification
|
|
315
|
+
tmux select-pane -t "$SESSION:0.1" -T "Worker: issue-42"
|
|
316
|
+
|
|
317
|
+
# Read pane title
|
|
318
|
+
tmux display-message -t "$SESSION:0.1" -p '#{pane_title}'
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## Phase 5: Socket and Session Management
|
|
324
|
+
|
|
325
|
+
### 5.1 Socket Detection
|
|
326
|
+
|
|
327
|
+
Identify which socket the current tmux session uses:
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
# Get the socket path from inside a tmux session
|
|
331
|
+
TMUX_SOCKET=$(tmux display-message -p '#{socket_path}')
|
|
332
|
+
echo "Socket: $TMUX_SOCKET"
|
|
333
|
+
|
|
334
|
+
# The TMUX env variable also encodes socket info
|
|
335
|
+
# Format: /path/to/socket,pid,session_index
|
|
336
|
+
echo "$TMUX"
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### 5.2 Multiple Servers
|
|
340
|
+
|
|
341
|
+
Run independent tmux servers for isolation:
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
# Start a tmux server on a custom socket
|
|
345
|
+
tmux -L my-custom-socket new-session -d -s "isolated"
|
|
346
|
+
|
|
347
|
+
# List sessions on a specific socket
|
|
348
|
+
tmux -L my-custom-socket list-sessions
|
|
349
|
+
|
|
350
|
+
# Target commands to a specific server
|
|
351
|
+
tmux -L my-custom-socket send-keys -t "isolated:0.0" "echo hello" Enter
|
|
352
|
+
|
|
353
|
+
# Kill a specific server
|
|
354
|
+
tmux -L my-custom-socket kill-server
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### 5.3 Environment Variables
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
# Pass environment variables into a tmux session
|
|
361
|
+
tmux set-environment -t "$SESSION" MY_VAR "my-value"
|
|
362
|
+
|
|
363
|
+
# Read an environment variable
|
|
364
|
+
tmux show-environment -t "$SESSION" MY_VAR
|
|
365
|
+
|
|
366
|
+
# Propagate env to new panes (global)
|
|
367
|
+
tmux set-environment -g MY_GLOBAL_VAR "global-value"
|
|
368
|
+
|
|
369
|
+
# Update environment from parent shell on reattach
|
|
370
|
+
tmux set-option -g update-environment "SSH_AUTH_SOCK DISPLAY"
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### 5.4 Session Survival
|
|
374
|
+
|
|
375
|
+
```bash
|
|
376
|
+
# Detach from a session (keeps it running)
|
|
377
|
+
tmux detach-client -t "$SESSION"
|
|
378
|
+
|
|
379
|
+
# Reattach to a session
|
|
380
|
+
tmux attach-session -t "$SESSION"
|
|
381
|
+
|
|
382
|
+
# Check if a session exists
|
|
383
|
+
tmux has-session -t "$SESSION" 2>/dev/null && echo "exists" || echo "not found"
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## Phase 6: Troubleshooting
|
|
389
|
+
|
|
390
|
+
### 6.1 Common Errors
|
|
391
|
+
|
|
392
|
+
| Error | Cause | Fix |
|
|
393
|
+
|-------|-------|-----|
|
|
394
|
+
| `no server running on /tmp/tmux-*/default` | tmux server not started | Start a session first: `tmux new-session -d -s tmp` |
|
|
395
|
+
| `can't find pane: %42` | Pane was killed or ID changed | Re-query: `tmux list-panes -t "$SESSION" -F '#{pane_id}'` |
|
|
396
|
+
| `session not found: foo` | Typo or session killed | Check: `tmux list-sessions` |
|
|
397
|
+
| `duplicate session: foo` | Session already exists | Use `tmux has-session -t foo` before creating |
|
|
398
|
+
| `create window failed: index in use: 0` | Window index conflict | Use `-a` flag or specify unused index |
|
|
399
|
+
| `pane too small` | Window area insufficient for split | Resize window or use fewer panes |
|
|
400
|
+
|
|
401
|
+
### 6.2 macOS vs Linux Differences
|
|
402
|
+
|
|
403
|
+
| Feature | macOS (Homebrew tmux) | Linux (apt/yum tmux) |
|
|
404
|
+
|---------|----------------------|----------------------|
|
|
405
|
+
| **Default version** | Usually latest (3.4+) | Varies: Ubuntu 22.04 ships 3.2a, older distros may have 2.x |
|
|
406
|
+
| **Socket path** | `/private/tmp/tmux-$UID/default` | `/tmp/tmux-$UID/default` |
|
|
407
|
+
| **Clipboard** | `pbcopy`/`pbpaste` | `xclip` or `xsel` (requires X11) |
|
|
408
|
+
| **`pane-border-status`** | Available (3.2+) | May not be available on older distros |
|
|
409
|
+
| **`pane-border-format`** | Available (3.4+) | Requires tmux 3.4+ (not in Ubuntu 22.04 default) |
|
|
410
|
+
| **`select-pane -P`** | Available (3.0+) | May need version check on old systems |
|
|
411
|
+
| **Reattach to user namespace** | No longer needed (macOS 10.10+) | N/A |
|
|
412
|
+
| **True color support** | Requires `set -g default-terminal "tmux-256color"` | Same — some terminals need `TERM=xterm-256color` |
|
|
413
|
+
|
|
414
|
+
**Version detection pattern:**
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
TMUX_VERSION=$(tmux -V | sed 's/tmux //')
|
|
418
|
+
TMUX_MAJOR=$(echo "$TMUX_VERSION" | cut -d. -f1)
|
|
419
|
+
TMUX_MINOR=$(echo "$TMUX_VERSION" | cut -d. -f2 | sed 's/[a-z]//g')
|
|
420
|
+
|
|
421
|
+
if [ "$TMUX_MAJOR" -ge 3 ] && [ "$TMUX_MINOR" -ge 2 ]; then
|
|
422
|
+
echo "tmux 3.2+ features available"
|
|
423
|
+
fi
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### 6.3 Debugging Techniques
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
# Verbose logging
|
|
430
|
+
tmux -v new-session -d -s debug
|
|
431
|
+
# Logs written to tmux-client-*.log and tmux-server-*.log in current dir
|
|
432
|
+
|
|
433
|
+
# Inspect tmux server state
|
|
434
|
+
tmux show-options -g # global options
|
|
435
|
+
tmux show-options -s # server options
|
|
436
|
+
tmux show-options -t "$SESSION" # session options
|
|
437
|
+
|
|
438
|
+
# List all key bindings
|
|
439
|
+
tmux list-keys
|
|
440
|
+
|
|
441
|
+
# Show all tmux environment variables
|
|
442
|
+
tmux show-environment -t "$SESSION"
|
|
443
|
+
|
|
444
|
+
# Check pane process
|
|
445
|
+
tmux list-panes -t "$SESSION:0" -F '#{pane_pid}: #{pane_current_command}'
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
## Verification Checklist
|
|
451
|
+
|
|
452
|
+
Before considering tmux automation complete:
|
|
453
|
+
|
|
454
|
+
- [ ] All `tmux` commands use explicit `-t` targets (no implicit context)
|
|
455
|
+
- [ ] Sessions and windows have meaningful names (not default indices)
|
|
456
|
+
- [ ] Pane readiness is verified before sending commands
|
|
457
|
+
- [ ] Error handling exists for "session not found" and "pane not found"
|
|
458
|
+
- [ ] Socket path is detected, not hardcoded
|
|
459
|
+
- [ ] Cleanup logic kills sessions/panes when workflow completes or errors
|
|
460
|
+
- [ ] Cross-platform compatibility verified (or version-gated features noted)
|
|
461
|
+
- [ ] Pane output capture works for the expected prompt pattern
|
|
462
|
+
|
|
463
|
+
## Red Flags — STOP
|
|
464
|
+
|
|
465
|
+
| Thought | Reality |
|
|
466
|
+
|---------|---------|
|
|
467
|
+
| "I don't need `-t`, there's only one session" | Other tools or users may create sessions. Always target explicitly. |
|
|
468
|
+
| "I'll hardcode the socket path" | Socket paths differ between macOS and Linux. Detect with `display-message`. |
|
|
469
|
+
| "The pane is probably ready by now" | Probably is not certainly. Poll for readiness before sending commands. |
|
|
470
|
+
| "I'll just `sleep 5` instead of polling" | Sleep is fragile — too short misses slow starts, too long wastes time. Poll. |
|
|
471
|
+
| "kill-server is fine for cleanup" | `kill-server` destroys ALL sessions, including unrelated ones. Target specific sessions. |
|
|
472
|
+
| "Pane colors are cosmetic, skip them" | In multi-agent workflows, color is the only way to visually identify pane roles. |
|
|
473
|
+
| "I'll parse tmux output with awk" | tmux has `-F` format strings for structured output. Use them. |
|
|
474
|
+
| "This works on my Mac, ship it" | Linux tmux versions vary wildly. Check `tmux -V` and gate features. |
|
|
475
|
+
|
|
476
|
+
## Related Skills
|
|
477
|
+
|
|
478
|
+
| Skill | Relationship |
|
|
479
|
+
|-------|-------------|
|
|
480
|
+
| `using-git-worktrees` | Worktrees provide filesystem isolation; tmux provides terminal isolation. Used together for parallel execution. |
|
|
481
|
+
| `dispatching-parallel-agents` | Dispatches agents into tmux panes for concurrent work. |
|
|
482
|
+
| `executing-plans` | Plan steps may execute in separate tmux panes. |
|
|
483
|
+
| `systematic-debugging` | Debugging tmux automation failures follows the same root-cause-first approach. |
|
|
484
|
+
|
|
485
|
+
## Related Agents
|
|
486
|
+
|
|
487
|
+
| Agent | When to Involve |
|
|
488
|
+
|-------|----------------|
|
|
489
|
+
| Platform Engineer | When tmux automation spans multiple environments (CI, local, remote) |
|
|
490
|
+
| DevOps Engineer | When tmux is part of deployment or infrastructure automation |
|
|
491
|
+
| Tooling Engineer | When building reusable tmux orchestration scripts |
|