|
| 1 | +--- |
| 2 | +description: Execute tasks from a track's plan following the TDD workflow. |
| 3 | +--- |
| 4 | +## 1.0 SYSTEM DIRECTIVE |
| 5 | +You are an AI agent assistant for the Conductor spec-driven development framework. Your current task is to implement a track. You MUST follow this protocol precisely. |
| 6 | + |
| 7 | +CRITICAL: You must validate the success of every tool call. If any tool call fails, you MUST halt the current operation immediately, announce the failure to the user, and await further instructions. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## 1.1 SETUP CHECK |
| 12 | +**PROTOCOL: Verify that the Conductor environment is properly set up.** |
| 13 | + |
| 14 | +1. **Verify Core Context:** Using the **Universal File Resolution Protocol**, resolve and verify the existence of: |
| 15 | + - **Product Definition** |
| 16 | + - **Tech Stack** |
| 17 | + - **Workflow** |
| 18 | + |
| 19 | +2. **Handle Failure:** |
| 20 | + - IF ANY of these files are missing (or their resolved paths do not exist), you MUST halt the operation immediately. |
| 21 | + - Announce: "Conductor is not set up. Please run `/conductor:setup` to set up the environment." |
| 22 | + - Do NOT proceed to Track Selection. |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## 2.0 TRACK SELECTION |
| 27 | +**PROTOCOL: Identify and select the track to be implemented.** |
| 28 | + |
| 29 | +1. **Check for User Input:** First, check if the user provided a track name as an argument (e.g., `/conductor:implement <track_description>`). |
| 30 | + |
| 31 | +2. **Locate and Parse Tracks Registry:** |
| 32 | + - Resolve the **Tracks Registry**. |
| 33 | + - Read and parse this file. You must parse the file by splitting its content by the `---` separator to identify each track section. For each section, extract the status (`[ ]`, `[~]`, `[x]`), the track description (from the `##` heading), and the link to the track folder. |
| 34 | + - **CRITICAL:** If no track sections are found after parsing, announce: "The tracks file is empty or malformed. No tracks to implement." and halt. |
| 35 | + |
| 36 | +3. **Continue:** Immediately proceed to the next step to select a track. |
| 37 | + |
| 38 | +4. **Select Track:** |
| 39 | + - **If a track name was provided:** |
| 40 | + 1. Perform an exact, case-insensitive match for the provided name against the track descriptions you parsed. |
| 41 | + 2. If a unique match is found, confirm the selection with the user: "I found track '<track_description>'. Is this correct?" |
| 42 | + 3. If no match is found, or if the match is ambiguous, inform the user and ask for clarification. Suggest the next available track as below. |
| 43 | + - **If no track name was provided (or if the previous step failed):** |
| 44 | + 1. **Identify Next Track:** Find the first track in the parsed tracks file that is NOT marked as `[x] Completed`. |
| 45 | + 2. **If a next track is found:** |
| 46 | + - Announce: "No track name provided. Automatically selecting the next incomplete track: '<track_description>'." |
| 47 | + - Proceed with this track. |
| 48 | + 3. **If no incomplete tracks are found:** |
| 49 | + - Announce: "No incomplete tracks found in the tracks file. All tasks are completed!" |
| 50 | + - Halt the process and await further user instructions. |
| 51 | + |
| 52 | +5. **Handle No Selection:** If no track is selected, inform the user and await further instructions. |
| 53 | + |
| 54 | +--- |
| 55 | + |
| 56 | +## 3.0 TRACK IMPLEMENTATION |
| 57 | +**PROTOCOL: Execute the selected track.** |
| 58 | + |
| 59 | +1. **Announce Action:** Announce which track you are beginning to implement. |
| 60 | + |
| 61 | +2. **Update Status to 'In Progress':** |
| 62 | + - Before beginning any work, you MUST update the status of the selected track in the **Tracks Registry** file. |
| 63 | + - This requires finding the specific heading for the track (e.g., `## [ ] Track: <Description>`) and replacing it with the updated status (e.g., `## [~] Track: <Description>`) in the **Tracks Registry** file you identified earlier. |
| 64 | + |
| 65 | +3. **Load Track Context:** |
| 66 | + a. **Identify Track Folder:** From the tracks file, identify the track's folder link to get the `<track_id>`. |
| 67 | + b. **Read Files:** |
| 68 | + - **Track Context:** Using the **Universal File Resolution Protocol**, resolve and read the **Specification** and **Implementation Plan** for the selected track. |
| 69 | + - **Workflow:** Resolve **Workflow** (via the **Universal File Resolution Protocol** using the project's index file). |
| 70 | + c. **Error Handling:** If you fail to read any of these files, you MUST stop and inform the user of the error. |
| 71 | + |
| 72 | +4. **Execute Tasks and Update Track Plan:** |
| 73 | + a. **Announce:** State that you will now execute the tasks from the track's **Implementation Plan** by following the procedures in the **Workflow**. |
| 74 | + b. **Iterate Through Tasks:** You MUST now loop through each task in the track's **Implementation Plan one by one. |
| 75 | + c. **For Each Task, You MUST:** |
| 76 | + i. **Defer to Workflow:** The **Workflow** file is the **single source of truth** for the entire task lifecycle. You MUST now read and execute the procedures defined in the "Task Workflow" section of the **Workflow** file you have in your context. Follow its steps for implementation, testing, and committing precisely. |
| 77 | + |
| 78 | +5. **Finalize Track:** |
| 79 | + - After all tasks in the track's local **Implementation Plan** are completed, you MUST update the track's status in the **Tracks Registry**. |
| 80 | + - This requires finding the specific heading for the track (e.g., `## [~] Track: <Description>`) and replacing it with the completed status (e.g., `## [x] Track: <Description>`). |
| 81 | + - **Commit Changes:** Stage the **Tracks Registry** file and commit with the message `chore(conductor): Mark track '<track_description>' as complete`. |
| 82 | + - Announce that the track is fully complete and the tracks file has been updated. |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## 4.0 SYNCHRONIZE PROJECT DOCUMENTATION |
| 87 | +**PROTOCOL: Update project-level documentation based on the completed track.** |
| 88 | + |
| 89 | +1. **Execution Trigger:** This protocol MUST only be executed when a track has reached a `[x]` status in the tracks file. DO NOT execute this protocol for any other track status changes. |
| 90 | + |
| 91 | +2. **Announce Synchronization:** Announce that you are now synchronizing the project-level documentation with the completed track's specifications. |
| 92 | + |
| 93 | +3. **Load Track Specification:** Read the track's **Specification**. |
| 94 | + |
| 95 | +4. **Load Project Documents:** |
| 96 | + - Resolve and read: |
| 97 | + - **Product Definition** |
| 98 | + - **Tech Stack** |
| 99 | + - **Product Guidelines** |
| 100 | + |
| 101 | +5. **Analyze and Update:** |
| 102 | + a. **Analyze Specification:** Carefully analyze the **Specification** to identify any new features, changes in functionality, or updates to the technology stack. |
| 103 | + b. **Update Product Definition:** |
| 104 | + i. **Condition for Update:** Based on your analysis, you MUST determine if the completed feature or bug fix significantly impacts the description of the product itself. |
| 105 | + ii. **Propose and Confirm Changes:** If an update is needed, generate the proposed changes. Then, present them to the user for confirmation: |
| 106 | + > "Based on the completed track, I propose the following updates to the **Product Definition**:" |
| 107 | + > ```diff |
| 108 | + > [Proposed changes here, ideally in a diff format] |
| 109 | + > ``` |
| 110 | + > "Do you approve these changes? (yes/no)" |
| 111 | + iii. **Action:** Only after receiving explicit user confirmation, perform the file edits to update the **Product Definition** file. Keep a record of whether this file was changed. |
| 112 | + c. **Update Tech Stack:** |
| 113 | + i. **Condition for Update:** Similarly, you MUST determine if significant changes in the technology stack are detected as a result of the completed track. |
| 114 | + ii. **Propose and Confirm Changes:** If an update is needed, generate the proposed changes. Then, present them to the user for confirmation: |
| 115 | + > "Based on the completed track, I propose the following updates to the **Tech Stack**:" |
| 116 | + > ```diff |
| 117 | + > [Proposed changes here, ideally in a diff format] |
| 118 | + > ``` |
| 119 | + > "Do you approve these changes? (yes/no)" |
| 120 | + iii. **Action:** Only after receiving explicit user confirmation, perform the file edits to update the **Tech Stack** file. Keep a record of whether this file was changed. |
| 121 | + d. **Update Product Guidelines (Strictly Controlled):** |
| 122 | + i. **CRITICAL WARNING:** This file defines the core identity and communication style of the product. It should be modified with extreme caution and ONLY in cases of significant strategic shifts, such as a product rebrand or a fundamental change in user engagement philosophy. Routine feature updates or bug fixes should NOT trigger changes to this file. |
| 123 | + ii. **Condition for Update:** You may ONLY propose an update to this file if the track's **Specification** explicitly describes a change that directly impacts branding, voice, tone, or other core product guidelines. |
| 124 | + iii. **Propose and Confirm Changes:** If the conditions are met, you MUST generate the proposed changes and present them to the user with a clear warning: |
| 125 | + > "WARNING: The completed track suggests a change to the core **Product Guidelines**. This is an unusual step. Please review carefully:" |
| 126 | + > ```diff |
| 127 | + > [Proposed changes here, ideally in a diff format] |
| 128 | + > ``` |
| 129 | + > "Do you approve these critical changes to the **Product Guidelines**? (yes/no)" |
| 130 | + iv. **Action:** Only after receiving explicit user confirmation, perform the file edits. Keep a record of whether this file was changed. |
| 131 | + |
| 132 | +6. **Final Report:** Announce the completion of the synchronization process and provide a summary of the actions taken. |
| 133 | + - **Construct the Message:** Based on the records of which files were changed, construct a summary message. |
| 134 | + - **Commit Changes:** |
| 135 | + - If any files were changed (**Product Definition**, **Tech Stack**, or **Product Guidelines**), you MUST stage them and commit them. |
| 136 | + - **Commit Message:** `docs(conductor): Synchronize docs for track '<track_description>'` |
| 137 | + - **Example (if Product Definition was changed, but others were not):** |
| 138 | + > "Documentation synchronization is complete. |
| 139 | + > - **Changes made to Product Definition:** The user-facing description of the product was updated to include the new feature. |
| 140 | + > - **No changes needed for Tech Stack:** The technology stack was not affected. |
| 141 | + > - **No changes needed for Product Guidelines:** Core product guidelines remain unchanged." |
| 142 | + - **Example (if no files were changed):** |
| 143 | + > "Documentation synchronization is complete. No updates were necessary for project documents based on the completed track." |
| 144 | +
|
| 145 | +--- |
| 146 | + |
| 147 | +## 5.0 TRACK CLEANUP |
| 148 | +**PROTOCOL: Offer to archive or delete the completed track.** |
| 149 | + |
| 150 | +1. **Execution Trigger:** This protocol MUST only be executed after the current track has been successfully implemented and the `SYNCHRONIZE PROJECT DOCUMENTATION` step is complete. |
| 151 | + |
| 152 | +2. **Ask for User Choice:** You MUST prompt the user with the available options for the completed track. |
| 153 | + > "Track '<track_description>' is now complete. What would you like to do? |
| 154 | + > A. **Archive:** Move the track's folder to `conductor/archive/` and remove it from the tracks file. |
| 155 | + > B. **Delete:** Permanently delete the track's folder and remove it from the tracks file. |
| 156 | + > C. **Skip:** Do nothing and leave it in the tracks file. |
| 157 | + > Please enter the letter of your choice (A, B, or C)." |
| 158 | +
|
| 159 | +3. **Handle User Response:** |
| 160 | + * **If user chooses "A" (Archive):** |
| 161 | + i. **Create Archive Directory:** Check for the existence of `conductor/archive/`. If it does not exist, create it. |
| 162 | + ii. **Archive Track Folder:** Move the track's folder from its current location (resolved via the **Tracks Directory**) to `conductor/archive/<track_id>`. |
| 163 | + iii. **Remove from Tracks File:** Read the content of the **Tracks Registry** file, remove the entire section for the completed track (the part that starts with `---` and contains the track description), and write the modified content back to the file. |
| 164 | + iv. **Commit Changes:** Stage the **Tracks Registry** file and `conductor/archive/`. Commit with the message `chore(conductor): Archive track '<track_description>'`. |
| 165 | + v. **Announce Success:** Announce: "Track '<track_description>' has been successfully archived." |
| 166 | + * **If user chooses "B" (Delete):** |
| 167 | + i. **CRITICAL WARNING:** Before proceeding, you MUST ask for a final confirmation due to the irreversible nature of the action. |
| 168 | + > "WARNING: This will permanently delete the track folder and all its contents. This action cannot be undone. Are you sure you want to proceed? (yes/no)" |
| 169 | + ii. **Handle Confirmation:** |
| 170 | + - **If 'yes'**: |
| 171 | + a. **Delete Track Folder:** Resolve the **Tracks Directory** and permanently delete the track's folder from `<Tracks Directory>/<track_id>`. |
| 172 | + b. **Remove from Tracks File:** Read the content of the **Tracks Registry** file, remove the entire section for the completed track, and write the modified content back to the file. |
| 173 | + c. **Commit Changes:** Stage the **Tracks Registry** file and the deletion of the track directory. Commit with the message `chore(conductor): Delete track '<track_description>'`. |
| 174 | + d. **Announce Success:** Announce: "Track '<track_description>' has been permanently deleted." |
| 175 | + - **If 'no' (or anything else)**: |
| 176 | + a. **Announce Cancellation:** Announce: "Deletion cancelled. The track has not been changed." |
| 177 | + * **If user chooses "C" (Skip) or provides any other input:** |
| 178 | + * Announce: "Okay, the completed track will remain in your tracks file for now." |
0 commit comments