Skip to content

Commit c41f05f

Browse files
feat: add tmux session monitoring infrastructure
Add tmux-monitor skill: - Discovers and categorizes all tmux sessions - Extracts metadata from .tmux-dev-session.json and agent JSON - Detects port usage and conflicts - Session categorization (dev-*, agent-*, etc.) - Generates compact, detailed, and JSON reports Add /tmux-status command: - User-facing wrapper around tmux-monitor skill - Three output modes: compact (default), detailed, json - Contextual recommendations for cleanup - Integration with tmuxwatch for real-time monitoring - Read-only, never modifies sessions
1 parent 53d4afd commit c41f05f

File tree

6 files changed

+1830
-0
lines changed

6 files changed

+1830
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# /tmux-status - Overview of All tmux Sessions
2+
3+
Show status of all tmux sessions including dev environments, spawned agents, and running processes.
4+
5+
## Usage
6+
7+
```bash
8+
/tmux-status # Compact overview
9+
/tmux-status --detailed # Full report with metadata
10+
/tmux-status --json # JSON export
11+
```
12+
13+
## Process
14+
15+
Invokes the `tmux-monitor` skill to discover and report on all active tmux sessions.
16+
17+
```bash
18+
# Get path to monitor script
19+
MONITOR_SCRIPT="${TOOL_DIR}/skills/tmux-monitor/scripts/monitor.sh"
20+
21+
[ ! -f "$MONITOR_SCRIPT" ] && echo "❌ tmux-monitor skill not found at $MONITOR_SCRIPT" && exit 1
22+
23+
# Determine output mode
24+
OUTPUT_MODE="compact"
25+
[[ "$1" == "--detailed" ]] || [[ "$1" == "-d" ]] && OUTPUT_MODE="detailed"
26+
[[ "$1" == "--json" ]] || [[ "$1" == "-j" ]] && OUTPUT_MODE="json"
27+
28+
# Execute monitor script
29+
bash "$MONITOR_SCRIPT" "$OUTPUT_MODE"
30+
```
31+
32+
## Output Modes
33+
34+
### Compact (Default)
35+
36+
Quick overview:
37+
38+
```
39+
5 active sessions:
40+
- dev-myapp-1705161234 (fullstack, 4 windows, active)
41+
- dev-api-service-1705159000 (backend-only, 4 windows, detached)
42+
- agent-1705160000 (codex, running)
43+
- agent-1705161000 (aider, completed ✓)
44+
- claude-work (main session, current)
45+
46+
3 running servers on ports: 8432,3891,5160
47+
48+
Use /tmux-status --detailed for full report
49+
```
50+
51+
### Detailed
52+
53+
Full report with metadata, services, ports, and recommendations.
54+
55+
### JSON
56+
57+
Programmatic output:
58+
59+
```json
60+
{
61+
"sessions": [
62+
{
63+
"name": "dev-myapp-1705161234",
64+
"type": "dev-environment",
65+
"windows": 4,
66+
"panes": 8,
67+
"attached": true
68+
}
69+
],
70+
"summary": {
71+
"total_sessions": 5,
72+
"total_windows": 12,
73+
"total_panes": 28
74+
}
75+
}
76+
```
77+
78+
## Contextual Recommendations
79+
80+
After displaying status, provide recommendations based on findings:
81+
82+
**Completed agents**:
83+
```
84+
⚠️ Found completed agent sessions
85+
Recommendation: Review and clean up: tmux kill-session -t <agent-session>
86+
```
87+
88+
**Long-running detached sessions**:
89+
```
90+
💡 Found dev sessions running >2 hours
91+
Recommendation: Check if still needed: tmux attach -t <session-name>
92+
```
93+
94+
**Many sessions (>5)**:
95+
```
96+
🧹 Found 5+ active sessions
97+
Recommendation: Review and clean up unused sessions
98+
```
99+
100+
## Use Cases
101+
102+
### Before Starting New Environment
103+
104+
```bash
105+
/tmux-status
106+
# Check for port conflicts and existing sessions before /start-local
107+
```
108+
109+
### Monitor Agent Progress
110+
111+
```bash
112+
/tmux-status
113+
# See status of spawned agents (running, completed, etc.)
114+
```
115+
116+
### Session Discovery
117+
118+
```bash
119+
/tmux-status --detailed
120+
# Find specific session by project name or port
121+
```
122+
123+
## Notes
124+
125+
- Read-only, never modifies sessions
126+
- Uses tmux-monitor skill for discovery
127+
- Integrates with tmuxwatch if available
128+
- Detects metadata from `.tmux-dev-session.json` and `~/.claude/agents/*.json`

0 commit comments

Comments
 (0)