Claude Code Task
v1.2.0运行 coding tasks using a persistent tmux 会话 with git worktree isolation. Supports multiple coding 代理s (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 代理 Task (tmux + worktree)
运行 coding tasks by spawning a coding 代理 in a tmux 会话 + git worktree. Every task 获取s its own isolated branch and persistent conversation.
Step 0: Determine which 代理 to use
检查 memory first:
memory_搜索("preferred coding 代理 工具")
If found → use that 工具, no need to ask
If not found → ask the user:
"Which coding 代理 should I use? (default: claude) Options: claude, codex, opencode, codebuddy, or any 命令行工具 工具 name"
Then save the answer to memory:
memory: preferred_coding_代理 = <工具>
Write to MEMORY.md under a "Preferences" section.
Default if user doesn't answer: claude
Step 1: 设置up worktree # Always use a worktree — one per task git -C worktree 添加 -b mAIn
# Symlink env files ln -sf /.env /.env ln -sf /.env.local /.env.local # if exists
Step 2: 启动 tmux 会话 with the chosen 代理 tmux new-会话 -d -s -c
Then launch based on 工具:
工具 Command claude claude --dangerously-skip-权限s codex codex opencode opencode codebuddy codebuddy (or 检查 its 命令行工具 name) other use the 工具's interactive 命令行工具 command tmux 发送-keys -t "nvm use 20 && <工具-command>" Enter
Step 3: 发送 task with plan-first instruction tmux 发送-keys -t -l -- "Your task here.
Before making any changes, show me a plan of what you intend to do and wAIt for my 应用roval." sleep 0.1 tmux 发送-keys -t Enter
Step 4: Relay plan to user # Poll for plan 输出 tmux capture-pane -t -p | tAIl -30
When 代理 输出s a plan → relay it to the user, wAIt for their confirmation before proceeding.
Relay flow:
代理 输出s plan → relay to user User says "ok" / 请求s changes → forward to 代理 代理 proceeds → 监控 and relay further questions # 发送 user's 响应 tmux 发送-keys -t -l -- "" sleep 0.1 tmux 发送-keys -t Enter
# 检查 if wAIting for 输入 tmux capture-pane -t -p | tAIl -10 | grep -E "❯|Yes.*No|proceed|权限|plan|应用rove"
Step 5: Parallel tasks
Same pattern, multiple 会话s:
tmux new-会话 -d -s task-a -c /tmp/task-a tmux new-会话 -d -s task-b -c /tmp/task-b
检查 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: 清理up git -C worktree 移除 # branch preserved tmux kill-会话 -t
# User can then test in mAIn workspace: # git switch
Rules 检查 memory first — never ask for 工具 preference if already saved Always use worktrees — one per task, no 异常s Always use tmux — persistent 会话, multi-turn conversation Always show plan first, wAIt for user 应用roval before 代理 touches files Always symlink .env files — don't copy One 状态 message when 启动ing, one when done or stuck See references/troubleshooting.md for common issues