Start Planning
Starting work on issue $ARGUMENTS. Setting up git branch and fetching issue details.
Workflow
- •Fetch issue details (if using Linear)
- •Set up git branch
- •Enter plan mode for implementation design
Step 1: Fetch Issue Details (Optional Linear Integration)
If the argument looks like a Linear issue ID (e.g., ATE-123) and Linearis CLI is available, fetch issue details:
# Check if linearis is available and argument looks like a Linear issue ISSUE_ID=$(echo "$ARGUMENTS" | grep -oE '^[A-Z]+-[0-9]+') if [ -n "$ISSUE_ID" ] && command -v linearis &> /dev/null; then # Try to fetch issue details linearis issues read "$ISSUE_ID" fi
If the fetch fails or Linearis is not installed, continue with just the issue ID as the branch name. The user can provide additional context manually.
Step 2: Set Up Git Branch
First, check if there are uncommitted changes:
if [ -n "$(git status --porcelain)" ]; then echo "You have uncommitted changes or untracked files in your working directory." fi
If uncommitted changes exist, use AskUserQuestion to prompt the user:
- •Stash changes - Save changes and continue
- •Commit changes - Create a quick commit first
- •Abort - Stop and let user handle manually
After handling uncommitted changes, prepare the repository:
BASE_BRANCH=$(../../scripts/get-base-branch.sh) git checkout "$BASE_BRANCH" git pull origin "$BASE_BRANCH" # Sanitize arguments for valid branch name BRANCH_NAME=$(echo "$ARGUMENTS" | tr -s '[:space:]' '-' | tr -cd '[:alnum:]-./_') if [ -z "$BRANCH_NAME" ] || ! git check-ref-format --branch "$BRANCH_NAME" >/dev/null 2>&1; then echo "ERROR: Could not create a valid branch name from '$ARGUMENTS'. Please provide a valid name." exit 1 fi git checkout -b "$BRANCH_NAME"
Step 3: Fetch and Display Issue Details
Parse the issue response and display:
- •Issue ID and Title
- •Description (full text)
- •Current Status
- •Labels (if any)
- •Suggested Branch Name (from Linear)
Step 4: Create Implementation Plan
You are now in plan mode. Your task is to:
- •Understand the requirement from the issue description
- •Explore the codebase to understand relevant files and patterns
- •Design the implementation approach
- •Create a detailed plan using TodoWrite with specific tasks
- •Present the plan to the user for approval
Do NOT start implementing until the user approves the plan.
When the plan is ready, use ExitPlanMode to request user approval.
After user approves, if using Linear integration, update the issue status (reusing ISSUE_ID from Step 1):
# Reuse ISSUE_ID from Step 1 - only update if it was a valid Linear issue if [ -n "$ISSUE_ID" ] && command -v linearis &> /dev/null; then linearis issues update "$ISSUE_ID" --state "In Progress" fi