Subtitle or tagline in italics
+| Column 1 | +Column 2 | +Column 3 | +
|---|---|---|
| Data | +Data | +Data | +
[1] Author, Name. "Article Title." Publication (Year). https://url.com — Brief description.
+[2] ...
+Key Takeaway: Important summary text here.
+``` + +### Step 3: Generate the PDF + +Use Chrome headless to generate the PDF without headers/footers: + +```bash +"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \ + --headless \ + --disable-gpu \ + --print-to-pdf="/path/to/output.pdf" \ + --print-to-pdf-no-header \ + --no-pdf-header-footer \ + "file:///path/to/input.html" +``` + +On Linux: +```bash +google-chrome --headless --disable-gpu --print-to-pdf="/path/to/output.pdf" --print-to-pdf-no-header --no-pdf-header-footer "file:///path/to/input.html" +``` + +## Style Guidelines + +1. **Paragraphs**: Keep text dense and justified. Collapse bullet points into flowing prose where appropriate. + +2. **Geek Corner**: Use for witty asides, technical insights, or memorable quotes. Always include: + - A catchy title (e.g., "Geek Corner: Amdahl's Law, App Edition") + - Italic content in quotes + +3. **Tables**: Use sparingly for data comparisons. Always use the open style (horizontal rules only). + +4. **References**: Always include full citations with: + - Author name + - Article/document title in quotes + - Publication/source and year + - Full clickable URL + - Brief description of what the reference covers + +5. **Spacing**: Keep tight - 6px paragraph margins, 1.35 line height. + +## Example Output + +See `/Users/stevengonsalvez/d/btg/multibrand/write-up-simple.html` for a complete example of this formatting applied to a technical write-up. diff --git a/claude-code-4.5/skills/tmux-monitor/SKILL.md b/claude-code-4.5/skills/tmux-monitor/SKILL.md new file mode 100644 index 0000000..42cb23c --- /dev/null +++ b/claude-code-4.5/skills/tmux-monitor/SKILL.md @@ -0,0 +1,370 @@ +--- +name: tmux-monitor +description: Monitor and report status of all tmux sessions including dev environments, spawned agents, and running processes. Uses tmuxwatch for enhanced visibility. +version: 1.0.0 +--- + +# tmux-monitor Skill + +## Purpose + +Provide comprehensive visibility into all active tmux sessions, running processes, and spawned agents. This skill enables checking what's running where without needing to manually inspect each session. + +## Capabilities + +1. **Session Discovery**: Find and categorize all tmux sessions +2. **Process Inspection**: Identify running servers, dev environments, agents +3. **Port Mapping**: Show which ports are in use and by what +4. **Status Reporting**: Generate detailed reports with recommendations +5. **tmuxwatch Integration**: Use tmuxwatch for enhanced real-time monitoring +6. **Metadata Extraction**: Read session metadata from .tmux-dev-session.json and agent JSON files + +## When to Use + +- User asks "what's running?" +- Before starting new dev environments (check port conflicts) +- After spawning agents (verify they started correctly) +- When debugging server/process issues +- Before session cleanup +- When context switching between projects + +## Implementation + +### Step 1: Check tmux Availability + +```bash +if ! command -v tmux &> /dev/null; then + echo "❌ tmux is not installed" + exit 1 +fi + +if ! tmux list-sessions 2>/dev/null; then + echo "✅ No tmux sessions currently running" + exit 0 +fi +``` + +### Step 2: Discover All Sessions + +```bash +# Get all sessions with metadata +SESSIONS=$(tmux list-sessions -F '#{session_name}|#{session_windows}|#{session_created}|#{session_attached}') + +# Count sessions +TOTAL_SESSIONS=$(echo "$SESSIONS" | wc -l | tr -d ' ') +``` + +### Step 3: Categorize Sessions + +Group by prefix pattern: + +- `dev-*` → Development environments +- `agent-*` → Spawned agents +- `claude-*` → Claude Code sessions +- `monitor-*` → Monitoring sessions +- Others → Miscellaneous + +```bash +DEV_SESSIONS=$(echo "$SESSIONS" | grep "^dev-" || true) +AGENT_SESSIONS=$(echo "$SESSIONS" | grep "^agent-" || true) +CLAUDE_SESSIONS=$(echo "$SESSIONS" | grep "^claude-" || true) +``` + +### Step 4: Extract Details for Each Session + +For each session, gather: + +**Window Information**: +```bash +tmux list-windows -t "$SESSION" -F '#{window_index}:#{window_name}:#{window_panes}' +``` + +**Running Processes** (from first pane of each window): +```bash +tmux capture-pane -t "$SESSION:0.0" -p -S -10 -E 0 +``` + +**Port Detection** (check for listening ports): +```bash +# Extract ports from session metadata +if [ -f ".tmux-dev-session.json" ]; then + BACKEND_PORT=$(jq -r '.backend.port // empty' .tmux-dev-session.json) + FRONTEND_PORT=$(jq -r '.frontend.port // empty' .tmux-dev-session.json) +fi + +# Or detect from process list +lsof -nP -iTCP -sTCP:LISTEN | grep -E "node|python|uv|npm" +``` + +### Step 5: Load Session Metadata + +**Dev Environment Metadata** (`.tmux-dev-session.json`): +```bash +if [ -f ".tmux-dev-session.json" ]; then + PROJECT=$(jq -r '.project' .tmux-dev-session.json) + TYPE=$(jq -r '.type' .tmux-dev-session.json) + BACKEND_PORT=$(jq -r '.backend.port // "N/A"' .tmux-dev-session.json) + FRONTEND_PORT=$(jq -r '.frontend.port // "N/A"' .tmux-dev-session.json) + CREATED=$(jq -r '.created' .tmux-dev-session.json) +fi +``` + +**Agent Metadata** (`~/.claude/agents/*.json`): +```bash +if [ -f "$HOME/.claude/agents/${SESSION}.json" ]; then + AGENT_TYPE=$(jq -r '.agent_type' "$HOME/.claude/agents/${SESSION}.json") + TASK=$(jq -r '.task' "$HOME/.claude/agents/${SESSION}.json") + STATUS=$(jq -r '.status' "$HOME/.claude/agents/${SESSION}.json") + DIRECTORY=$(jq -r '.directory' "$HOME/.claude/agents/${SESSION}.json") + CREATED=$(jq -r '.created' "$HOME/.claude/agents/${SESSION}.json") +fi +``` + +### Step 6: tmuxwatch Integration + +If tmuxwatch is available, offer enhanced view: + +```bash +if command -v tmuxwatch &> /dev/null; then + echo "" + echo "📊 Enhanced Monitoring Available:" + echo " Real-time TUI: tmuxwatch" + echo " JSON export: tmuxwatch --dump | jq" + echo "" + + # Optional: Use tmuxwatch for structured data + TMUXWATCH_DATA=$(tmuxwatch --dump 2>/dev/null || echo "{}") +fi +``` + +### Step 7: Generate Comprehensive Report + +```markdown +# tmux Sessions Overview + +**Total Active Sessions**: {count} +**Total Windows**: {window_count} +**Total Panes**: {pane_count} + +--- + +## Development Environments ({dev_count}) + +### 1. dev-myapp-1705161234 +- **Type**: fullstack +- **Project**: myapp +- **Status**: ⚡ Active (attached) +- **Windows**: 4 (servers, logs, claude-work, git) +- **Panes**: 8 +- **Backend**: Port 8432 → http://localhost:8432 +- **Frontend**: Port 3891 → http://localhost:3891 +- **Created**: 2025-01-13 14:30:00 (2h ago) +- **Attach**: `tmux attach -t dev-myapp-1705161234` + +--- + +## Spawned Agents ({agent_count}) + +### 2. agent-1705160000 +- **Agent Type**: codex +- **Task**: Refactor authentication module +- **Status**: ⚙️ Running (15 minutes) +- **Working Directory**: /Users/stevie/projects/myapp +- **Git Worktree**: worktrees/agent-1705160000 +- **Windows**: 1 (work) +- **Panes**: 2 (agent | monitoring) +- **Last Output**: "Analyzing auth.py dependencies..." +- **Attach**: `tmux attach -t agent-1705160000` +- **Metadata**: `~/.claude/agents/agent-1705160000.json` + +### 3. agent-1705161000 +- **Agent Type**: aider +- **Task**: Generate API documentation +- **Status**: ✅ Completed (5 minutes ago) +- **Output**: Documentation written to docs/api/ +- **Attach**: `tmux attach -t agent-1705161000` (review) +- **Cleanup**: `tmux kill-session -t agent-1705161000` + +--- + +## Running Processes Summary + +| Port | Service | Session | Status | +|------|--------------|--------------------------|---------| +| 8432 | Backend API | dev-myapp-1705161234 | Running | +| 3891 | Frontend Dev | dev-myapp-1705161234 | Running | +| 5160 | Supabase | dev-shotclubhouse-xxx | Running | + +--- + +## Quick Actions + +**Attach to session**: +```bash +tmux attach -t