Claude Code Task
by @yuanshenstarto
Run coding tasks using a persistent tmux session with git worktree isolation. Supports multiple coding agents (Claude Code, Codex, CodeBuddy, OpenCode, etc.)...
clawhub install claude-code-tmuxπ About This Skill
name: claude-code-task description: Run coding tasks using a persistent tmux session with git worktree isolation. Supports multiple coding agents (Claude Code, Codex, CodeBuddy, OpenCode, etc.). Activate when user asks to build, fix, refactor, or review code. Always uses tmux for persistent multi-turn conversation β never one-shot mode.
Coding Agent Task (tmux + worktree)
Run coding tasks by spawning a coding agent in a tmux session + git worktree. Every task gets its own isolated branch and persistent conversation.
Step 0: Determine which agent to use
Check memory first:
memory_search("preferred coding agent tool")
> "Which coding agent should I use? (default: claude) > Options: claude, codex, opencode, codebuddy, or any CLI tool name"
Then save the answer to memory:
memory: preferred_coding_agent =
Write to MEMORY.md under a "Preferences" section.Default if user doesn't answer: claude
Step 1: Setup worktree
# Always use a worktree β one per task
git -C worktree add -b mainSymlink env files
ln -sf /.env /.env
ln -sf /.env.local /.env.local # if exists
Step 2: Start tmux session with the chosen agent
tmux new-session -d -s -c
Then launch based on tool:
| Tool | Command |
|---|---|
| claude | claude --dangerously-skip-permissions |
| codex | codex |
| opencode | opencode |
| codebuddy | codebuddy (or check its CLI name) |
| other | use the tool's interactive CLI command |
tmux send-keys -t "nvm use 20 && " Enter
Step 3: Send task with plan-first instruction
tmux send-keys -t -l -- "Your task here.Before making any changes, show me a plan of what you intend to do and wait for my approval."
sleep 0.1
tmux send-keys -t Enter
Step 4: Relay plan to user
# Poll for plan output
tmux capture-pane -t -p | tail -30
When agent outputs a plan β relay it to the user, wait for their confirmation before proceeding.
Relay flow: 1. Agent outputs plan β relay to user 2. User says "ok" / requests changes β forward to agent 3. Agent proceeds β monitor and relay further questions
# Send user's response
tmux send-keys -t -l -- ""
sleep 0.1
tmux send-keys -t EnterCheck if waiting for input
tmux capture-pane -t -p | tail -10 | grep -E "β―|Yes.*No|proceed|permission|plan|approve"
Step 5: Parallel tasks
Same pattern, multiple sessions:
tmux new-session -d -s task-a -c /tmp/task-a
tmux new-session -d -s task-b -c /tmp/task-b
Check all at once:
for s in task-a task-b; do
echo "=== $s ==="
tmux capture-pane -t $s -p 2>/dev/null | tail -5
done
Step 6: Cleanup
git -C worktree remove # branch preserved
tmux kill-session -t User can then test in main workspace:
git switch
Rules
.env files β don't copyreferences/troubleshooting.md for common issuesπ Constraints
.env files β don't copyreferences/troubleshooting.md for common issues