sidequest

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Sidequest: Spawn Parallel Claude Sessions

Sidequest:开启并行Claude会话

Launch a new Claude Code session in a separate terminal to work on a different task while keeping your current session active.
在独立终端中启动新的Claude Code会话,以便在保持当前会话活跃的同时处理不同任务。

Usage

使用方法

/sidequest "Add a settings page with dark mode toggle"
/sidequest "Set up the database schema" --no-context
/sidequest  # Interactive prompt for task description
/sidequest "添加带深色模式切换的设置页面"
/sidequest "搭建数据库架构" --no-context
/sidequest  # 交互式输入任务描述

What It Does

功能说明

  1. Gathers context (unless
    --no-context
    ):
    • Current working directory
    • Current git branch
    • Brief summary of what's being worked on
    • Key files recently modified/read
  2. Opens new terminal tab/window:
    • macOS Terminal.app or iTerm2 supported
    • Automatically detects which terminal is in use
  3. Starts Claude with context:
    bash
    cd "<current_directory>" && claude -p "<context_prompt>"
  4. Returns control to original session (user continues main task)
  1. 收集上下文(除非使用
    --no-context
    ):
    • 当前工作目录
    • 当前Git分支
    • 当前任务的简要概述
    • 最近修改/读取的关键文件
  2. 打开新终端标签页/窗口
    • 支持macOS Terminal.app或iTerm2
    • 自动检测当前使用的终端
  3. 携带上下文启动Claude
    bash
    cd "<current_directory>" && claude -p "<context_prompt>"
  4. 返回控制权至原会话(用户可继续处理主任务)

Flags

标识参数

FlagDescription
--no-context
Start fresh without context from parent session
--iterm
Force use of iTerm (auto-detected by default)
--terminal
Force use of Terminal.app (auto-detected by default)
参数说明
--no-context
不携带父会话上下文,全新启动
--iterm
强制使用iTerm(默认自动检测)
--terminal
强制使用Terminal.app(默认自动检测)

Implementation

实现流程

When user invokes
/sidequest
, execute the following:
当用户调用
/sidequest
时,执行以下步骤:

Step 1: Parse Arguments

步骤1:解析参数

Check if the user provided:
  • A task description (required, or prompt for it)
  • --no-context
    flag (skip context entirely)
If no task description provided, ask the user what they want to work on.
检查用户是否提供:
  • 任务描述(必填,若无则弹出交互式输入)
  • --no-context
    参数(跳过上下文收集)
若未提供任务描述,询问用户需要处理的事项。

Step 2: Ask About Context (unless --no-context)

步骤2:询问上下文设置(除非使用--no-context)

IMPORTANT: If
--no-context
was NOT specified, use the
AskUserQuestion
tool to ask:
Use AskUserQuestion with:
- question: "Include a summary of this chat in the sidequest?"
- header: "Context"
- options:
  1. "Yes, include summary" - "Pass context about current work to help the new session understand what you're doing"
  2. "No, start fresh" - "Start the sidequest with no context from this session"
重要提示:若未指定
--no-context
,使用
AskUserQuestion
工具询问:
调用AskUserQuestion时传入:
- question: "是否将当前对话的摘要带入sidequest?"
- header: "上下文设置"
- options:
  1. "是,带入摘要" - "传递当前工作的上下文,帮助新会话了解你的工作内容"
  2. "否,全新启动" - "启动sidequest时不携带当前会话的任何上下文"

Step 3: Gather Context (if user chose to include summary)

步骤3:收集上下文(若用户选择带入摘要)

If user selected "Yes, include summary":
  1. Summarize the current conversation (what task is being worked on, key decisions made)
  2. Get current git branch:
    git branch --show-current
  3. Identify key files from recent tool calls
  4. Note any relevant todos or blockers
If user selected "No, start fresh":
  • Skip context gathering, proceed with just the task description
若用户选择“是,带入摘要”:
  1. 总结当前对话内容(正在处理的任务、已做出的关键决策)
  2. 获取当前Git分支:
    git branch --show-current
  3. 从最近的工具调用中识别关键文件
  4. 记录相关待办事项或阻碍
若用户选择“否,全新启动”:
  • 跳过上下文收集,仅使用任务描述启动

Step 4: Build Context Prompt

步骤4:构建上下文提示语

Format the prompt for the new session:
With context:
SIDEQUEST from main task.

Main task context:
- Working directory: /path/to/project
- Git branch: feature/user-auth
- Was working on: <summary of current task>
- Key files: <recent files>
- Progress: <key progress and decisions made>

Your sidequest task: <user's task description>

This is separate from the main task. Focus only on this sidequest.
Without context:
SIDEQUEST MODE

Your task: <user's task description>

This is an independent task. Focus only on completing this sidequest.
为新会话格式化提示语:
携带上下文时
来自主任务的SIDEQUEST。

主任务上下文:
- 工作目录:/path/to/project
- Git分支:feature/user-auth
- 当前任务:<当前任务摘要>
- 关键文件:<近期操作的文件>
- 进度:<关键进展与决策>

你的sidequest任务:<用户输入的任务描述>

此任务独立于主任务,请仅专注于该sidequest。
不携带上下文时
SIDEQUEST模式

你的任务:<用户输入的任务描述>

这是一个独立任务,请仅专注于完成该sidequest。

Step 5: Detect Terminal and Launch

步骤5:检测终端并启动

bash
undefined
bash
undefined

Detect terminal

检测终端

if [[ -z "$TERMINAL_APP" ]]; then if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then TERMINAL_APP="iTerm" else TERMINAL_APP="Terminal" fi fi
if [[ -z "$TERMINAL_APP" ]]; then if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then TERMINAL_APP="iTerm" else TERMINAL_APP="Terminal" fi fi

Escape the prompt for shell

对提示语进行Shell转义

ESCAPED_PROMPT=$(echo "$CONTEXT_PROMPT" | sed 's/"/\"/g')
ESCAPED_PROMPT=$(echo "$CONTEXT_PROMPT" | sed 's/"/\"/g')

Launch based on terminal

根据终端类型启动

if [[ "$TERMINAL_APP" == "iTerm" ]]; then osascript -e "tell application "iTerm" tell current window create tab with default profile tell current session write text "cd '$PWD' && claude -p \"$ESCAPED_PROMPT\"" end tell end tell end tell" else osascript -e "tell application "Terminal" activate do script "cd '$PWD' && claude -p \"$ESCAPED_PROMPT\"" end tell" fi
undefined
if [[ "$TERMINAL_APP" == "iTerm" ]]; then osascript -e "tell application "iTerm" tell current window create tab with default profile tell current session write text "cd '$PWD' && claude -p \"$ESCAPED_PROMPT\"" end tell end tell end tell" else osascript -e "tell application "Terminal" activate do script "cd '$PWD' && claude -p \"$ESCAPED_PROMPT\"" end tell" fi
undefined

Step 6: Confirm to User

步骤6:向用户确认

After launching, inform the user:
Sidequest started in new terminal!
Task: <task description>
Continue your main quest here.
启动完成后,告知用户:
Sidequest已在新终端启动!
任务:<任务描述>
请在此继续处理你的主任务。

Example Workflow

示例流程

Main terminal (building user authentication):
You: Working on the login API endpoint...
You: /sidequest "Add a settings page with dark mode toggle"

Claude: [AskUserQuestion]
        Include a summary of this chat in the sidequest?

        > Yes, include summary
          No, start fresh

You: (selects "Yes, include summary")

Claude: Sidequest started in new terminal!
        Task: Add a settings page with dark mode toggle
        Context: Included summary of current auth work
        Continue your main quest here.

You: (continues auth work)
New terminal (opens automatically):
Claude: SIDEQUEST MODE
        Task: Add a settings page with dark mode toggle

        Context from main session:
        - Working on: Building user authentication with JWT
        - Branch: feature/user-auth
        - Key files: auth.ts, login.tsx, middleware.ts
        - Progress: Login endpoint complete, working on token refresh

        Let me look at the existing pages structure...
Example without context:
You: /sidequest "Set up CI/CD pipeline" --no-context
Claude: Sidequest started in new terminal!
        Task: Set up CI/CD pipeline
        (No context passed - starting fresh)
主终端(正在开发用户认证功能):
你:正在开发登录API端点...
你:/sidequest "添加带深色模式切换的设置页面"

Claude: [弹出AskUserQuestion]
        是否将当前对话的摘要带入sidequest?

        > 是,带入摘要
          否,全新启动

你:(选择“是,带入摘要”)

Claude: Sidequest已在新终端启动!
        任务:添加带深色模式切换的设置页面
        上下文:已包含当前认证任务的摘要
        请在此继续处理你的主任务。

你:(继续开发认证功能)
新终端(自动打开):
Claude: SIDEQUEST模式
        任务:添加带深色模式切换的设置页面

        来自主会话的上下文:
        - 当前任务:基于JWT开发用户认证功能
        - 分支:feature/user-auth
        - 关键文件:auth.ts, login.tsx, middleware.ts
        - 进度:登录端点已完成,正在开发令牌刷新功能

        让我查看现有页面的结构...
不带上下文的示例:
你:/sidequest "搭建CI/CD流水线" --no-context
Claude: Sidequest已在新终端启动!
        任务:搭建CI/CD流水线
        (未传递上下文 - 全新启动)

Script Location

脚本位置

The sidequest shell script is located at:
${CLAUDE_PLUGIN_ROOT}/skills/sidequest/scripts/sidequest.sh
sidequest shell脚本位于:
${CLAUDE_PLUGIN_ROOT}/skills/sidequest/scripts/sidequest.sh

Execution

执行方式

To run a sidequest:
bash
bash "${CLAUDE_PLUGIN_ROOT}/skills/sidequest/scripts/sidequest.sh" \
  --task "Your task description" \
  --context "Summary of current work" \
  --branch "$(git branch --show-current 2>/dev/null || echo 'N/A')" \
  --files "auth.ts,login.tsx"
Or without context:
bash
bash "${CLAUDE_PLUGIN_ROOT}/skills/sidequest/scripts/sidequest.sh" \
  --task "Your task description" \
  --no-context
运行sidequest:
bash
bash "${CLAUDE_PLUGIN_ROOT}/skills/sidequest/scripts/sidequest.sh" \
  --task "你的任务描述" \
  --context "当前工作的摘要" \
  --branch "$(git branch --show-current 2>/dev/null || echo 'N/A')" \
  --files "auth.ts,login.tsx"
或不带上下文:
bash
bash "${CLAUDE_PLUGIN_ROOT}/skills/sidequest/scripts/sidequest.sh" \
  --task "你的任务描述" \
  --no-context

Requirements

依赖要求

  • macOS (uses osascript for terminal control)
  • Terminal.app or iTerm2
  • Claude Code CLI installed (
    claude
    command available)
  • macOS(使用osascript控制终端)
  • Terminal.app或iTerm2
  • 已安装Claude Code CLI(可使用
    claude
    命令)

Notes

注意事项

  • The sidequest runs independently - changes in one session don't affect the other
  • Both sessions share the same working directory and git state
  • Be careful with conflicting file edits between sessions
  • Use
    git stash
    if you need to switch context between sessions
  • sidequest独立运行,一个会话中的修改不会影响另一个会话
  • 两个会话共享相同的工作目录和Git状态
  • 注意避免会话间出现文件编辑冲突
  • 若需要在会话间切换上下文,可使用
    git stash