Skip to content
Back to skills

Tmux Background Agents

ASecurity

Manage background Claude Code sessions using tmux. Start agents, send prompts, read responses, and hand off to Terminal windows - all without interrupting your main session.

  • 7 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added June 6, 2026
ai-agentsswiftbash

Works with

  • claude code
  • terminal
  • cli

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned June 6, 2026

npx -y skills add mediar-ai/skillhubz --skill tmux-background-agents --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tmux Background Agents?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Tmux Background Agents
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mediar-ai-tmux-background-agents/badge)](https://www.skillsdirectory.com/skills/mediar-ai-tmux-background-agents)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# tmux Background Agents

Manage background Claude Code sessions using tmux. Start agents, send prompts, read responses, and hand off to Terminal windows - all without interrupting your main session.

## Prerequisites

- macOS with Terminal.app
- tmux installed (`brew install tmux`)
- Claude Code CLI installed

## Instructions

### Start a new background Claude session

```bash
# Basic - starts in specified directory
tmux new-session -d -s SESSION_NAME "cd /path/to/dir && claude --dangerously-skip-permissions"

# With initial prompt
tmux new-session -d -s SESSION_NAME "cd /path/to/dir && claude --dangerously-skip-permissions 'YOUR PROMPT HERE'"
```

### Send a prompt to an existing session

```bash
tmux send-keys -t SESSION_NAME "your prompt here" Enter
```

Note: Sometimes an extra `Enter` is needed:
```bash
tmux send-keys -t SESSION_NAME Enter
```

### Read response from a session

```bash
tmux capture-pane -t SESSION_NAME -p
```

For full scrollback:
```bash
tmux capture-pane -t SESSION_NAME -p -S -100
```

### List all sessions

```bash
tmux ls
```

### Open a session in a Terminal window (hand off to user)

```bash
osascript <<'APPLESCRIPT'
tell application "Terminal"
  activate
  do script "tmux attach -t SESSION_NAME"
end tell
APPLESCRIPT
```

### Kill a session

```bash
tmux kill-session -t SESSION_NAME
```

## Workflow Example

1. **Start session:**
```bash
tmux new-session -d -s my-agent "cd ~/project && claude --dangerously-skip-permissions"
sleep 5
```

2. **Send prompt:**
```bash
tmux send-keys -t my-agent "Fix the bug in auth.swift" Enter
```

3. **Wait and read response:**
```bash
sleep 15
tmux capture-pane -t my-agent -p
```

4. **Hand off to user:**
```bash
osascript -e 'tell application "Terminal" to do script "tmux attach -t my-agent"'
```

## User Request Mapping

When the user asks to:
- "start a background agent" → create tmux session with Claude
- "send prompt to agent X" → use `tmux send-keys`
- "check agent X" → use `tmux capture-pane`
- "open agent X" → open Terminal attached to tmux session
- "list agents" → use `tmux ls`
- "stop agent X" → use `tmux kill-session`

## Tips

- Always wait 5-8 seconds after starting a session for Claude to initialize
- After sending a prompt, wait 10-15 seconds for response
- Send an extra `Enter` if the prompt doesn't seem to submit
- Use descriptive session names like `auth-fix`, `ui-refactor`, etc.

Files in this skill

  • manifest.json339 B
  • skill.md2.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.