@@ -1079,18 +1079,21 @@ customModes:
10791079 3. For PRs, also use get_pull_request_reviews to get review feedback
10801080 4. Identify all requirements, acceptance criteria, and technical details
10811081 5. List any related issues, PRs, or discussions mentioned
1082+ 6. Check if the issue/PR specifies a target branch or if there are branch requirements
10821083
10831084 DO NOT:
10841085 - Attempt to implement anything yet
10851086 - Make design decisions yet
10861087 - Explore the codebase yet
1088+ - Make any branch changes yet
10871089
10881090 When complete, use attempt_completion to provide:
10891091 - Full issue/PR details including number, title, and type
10901092 - All requirements and acceptance criteria
10911093 - Key technical details mentioned
10921094 - Related issues/PRs/discussions
10931095 - For PRs: specific changes requested in reviews
1096+ - Target branch information (if specified in issue/PR or comments)
10941097
10951098 This information will be used to coordinate the implementation workflow.
10961099 </message>
@@ -1101,9 +1104,56 @@ customModes:
11011104 </step>
11021105
11031106 <step number="2">
1107+ <name>Branch Verification and Setup</name>
1108+ <instructions>
1109+ Before proceeding with any implementation work, ensure we're on the correct branch:
1110+
1111+ <new_task>
1112+ <mode>issue-worker</mode>
1113+ <message>
1114+ I need you to verify and ensure we're working on the correct git branch for GitHub issue/PR #[number].
1115+
1116+ CONTEXT FROM ANALYSIS:
1117+ [Include target branch information from step 1]
1118+ - Issue/PR number: #[number]
1119+ - Target branch: [branch name if specified, otherwise 'main' or 'master']
1120+ - Issue type: [bug fix, feature, etc.]
1121+
1122+ SCOPE:
1123+ 1. Check the current git branch using git utilities
1124+ 2. Determine the correct target branch:
1125+ - If specified in the issue/PR, use that branch
1126+ - For bug fixes: typically 'main' or 'master'
1127+ - For features: may be 'main', 'develop', or a specific feature branch
1128+ - For PR feedback: use the PR's target branch
1129+ 3. If not on the correct branch, switch to it using git utilities
1130+ 4. Verify the branch switch was successful
1131+ 5. Report the current branch status
1132+
1133+ IMPORTANT:
1134+ - Use the git utility functions from src/utils/git.ts
1135+ - If branch switching fails, report the issue and ask for guidance
1136+ - Do not proceed with any code changes until on the correct branch
1137+
1138+ When complete, use attempt_completion to provide:
1139+ - Current branch name
1140+ - Target branch name
1141+ - Whether branch switch was needed and successful
1142+ - Any branch-related issues or warnings
1143+ - Confirmation that we're ready to proceed with implementation
1144+
1145+ This ensures all subsequent work happens on the correct branch.
1146+ </message>
1147+ </new_task>
1148+
1149+ Wait for branch verification to complete before proceeding.
1150+ </instructions>
1151+ </step>
1152+
1153+ <step number="3">
11041154 <name>Architecture and Design Planning</name>
11051155 <instructions>
1106- Based on the context gathered, delegate design planning to architect mode :
1156+ Based on the context gathered and branch verification , delegate design planning:
11071157
11081158 <new_task>
11091159 <mode>issue-worker</mode>
@@ -1116,6 +1166,11 @@ customModes:
11161166 - Acceptance criteria: [list all criteria]
11171167 - Technical constraints: [any mentioned constraints]
11181168
1169+ BRANCH CONTEXT:
1170+ [Include branch information from step 2]
1171+ - Current branch: [branch name]
1172+ - Confirmed we're on the correct branch for this work
1173+
11191174 SCOPE:
11201175 1. Analyze the requirements and create a detailed implementation approach
11211176 2. Identify all components that need to be created or modified
@@ -1151,7 +1206,7 @@ customModes:
11511206 </instructions>
11521207 </step>
11531208
1154- <step number="3 ">
1209+ <step number="4 ">
11551210 <name>Codebase Exploration</name>
11561211 <instructions>
11571212 With the architectural plan ready, delegate detailed codebase exploration:
@@ -1200,7 +1255,7 @@ customModes:
12001255 </instructions>
12011256 </step>
12021257
1203- <step number="4 ">
1258+ <step number="5 ">
12041259 <name>Final Verification and Summary</name>
12051260 <instructions>
12061261 After the complete implementation is finished:
@@ -1241,7 +1296,7 @@ customModes:
12411296 </instructions>
12421297 </step>
12431298
1244- <step number="5 ">
1299+ <step number="6 ">
12451300 <name>Pull Request Creation</name>
12461301 <instructions>
12471302 If user approves, coordinate PR creation:
0 commit comments