diff --git a/commands/conductor/implement.toml b/commands/conductor/implement.toml index e759791..3be76a4 100644 --- a/commands/conductor/implement.toml +++ b/commands/conductor/implement.toml @@ -35,13 +35,29 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai 4. **Select Track:** - **If a track name was provided:** 1. Perform an exact, case-insensitive match for the provided name against the track descriptions you parsed. - 2. If a unique match is found, confirm the selection with the user: "I found track ''. Is this correct?" - 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. + 2. If a unique match is found, immediately call the `ask_user` tool to confirm the selection (do not repeat the question in the chat): + - **questions:** + - **header:** "Confirm" + - **question:** "I found track ''. Is this correct?" + - **type:** "yesno" + 3. If no match is found, or if the match is ambiguous, immediately call the `ask_user` tool to inform the user and request the correct track name (do not repeat the question in the chat): + - **questions:** + - **header:** "Clarify" + - **question:** "I couldn't find a unique track matching the name you provided. Did you mean ''? Or please type the exact track name." + - **type:** "text" - **If no track name was provided (or if the previous step failed):** 1. **Identify Next Track:** Find the first track in the parsed tracks file that is NOT marked as `[x] Completed`. 2. **If a next track is found:** - - Announce: "No track name provided. Automatically selecting the next incomplete track: ''." - - Proceed with this track. + - Immediately call the `ask_user` tool to confirm the selection (do not repeat the question in the chat): + - **questions:** + - **header:** "Next Track" + - **question:** "No track name provided. Would you like to proceed with the next incomplete track: ''?" + - **type:** "yesno" + - If confirmed, proceed with this track. Otherwise, immediately call the `ask_user` tool to request the correct track name (do not repeat the question in the chat): + - **questions:** + - **header:** "Clarify" + - **question:** "Please type the exact name of the track you would like to implement." + - **type:** "text" 3. **If no incomplete tracks are found:** - Announce: "No incomplete tracks found in the tracks file. All tasks are completed!" - Halt the process and await further user instructions. @@ -71,6 +87,7 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai b. **Iterate Through Tasks:** You MUST now loop through each task in the track's **Implementation Plan** one by one. c. **For Each Task, You MUST:** 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. + - **CRITICAL:** Every human-in-the-loop interaction, confirmation, or request for feedback mentioned in the **Workflow** (e.g., manual verification plans or guidance on persistent failures) MUST be conducted using the `ask_user` tool. 5. **Finalize Track:** - After all tasks in the track's local **Implementation Plan** are completed, you MUST update the track's status in the **Tracks Registry**. @@ -99,31 +116,34 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai a. **Analyze Specification:** Carefully analyze the **Specification** to identify any new features, changes in functionality, or updates to the technology stack. b. **Update Product Definition:** 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. - ii. **Propose and Confirm Changes:** If an update is needed, generate the proposed changes. Then, present them to the user for confirmation: - > "Based on the completed track, I propose the following updates to the **Product Definition**:" - > ```diff - > [Proposed changes here, ideally in a diff format] - > ``` - > "Do you approve these changes? (yes/no)" + ii. **Propose and Confirm Changes:** If an update is needed: + - **Present Content:** First, display the proposed updates to the **Product Definition** (ideally in a diff format) to the user in the chat. + - **Ask for Approval:** Then, use the `ask_user` tool to request confirmation: + - **questions:** + - **header:** "Prod Definition" + - **question:** "Do you approve these changes to the Product Definition?" + - **type:** "yesno" 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. c. **Update Tech Stack:** i. **Condition for Update:** Similarly, you MUST determine if significant changes in the technology stack are detected as a result of the completed track. - ii. **Propose and Confirm Changes:** If an update is needed, generate the proposed changes. Then, present them to the user for confirmation: - > "Based on the completed track, I propose the following updates to the **Tech Stack**:" - > ```diff - > [Proposed changes here, ideally in a diff format] - > ``` - > "Do you approve these changes? (yes/no)" + ii. **Propose and Confirm Changes:** If an update is needed: + - **Present Content:** First, display the proposed updates to the **Tech Stack** (ideally in a diff format) to the user in the chat. + - **Ask for Approval:** Then, use the `ask_user` tool to request confirmation: + - **questions:** + - **header:** "Tech Stack" + - **question:** "Do you approve these changes to the Tech Stack?" + - **type:** "yesno" 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. d. **Update Product Guidelines (Strictly Controlled):** 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. 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. - 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: - > "WARNING: The completed track suggests a change to the core **Product Guidelines**. This is an unusual step. Please review carefully:" - > ```diff - > [Proposed changes here, ideally in a diff format] - > ``` - > "Do you approve these critical changes to the **Product Guidelines**? (yes/no)" + iii. **Propose and Confirm Changes:** If the conditions are met: + - **Present Content:** First, display the proposed changes to the **Product Guidelines** (ideally in a diff format) to the user in the chat, including a clear warning. + - **Ask for Approval:** Then, use the `ask_user` tool to request confirmation: + - **questions:** + - **header:** "Prod Guidelines" + - **question:** "WARNING: This is an unusual step. Do you approve these critical changes to the Product Guidelines?" + - **type:** "yesno" iv. **Action:** Only after receiving explicit user confirmation, perform the file edits. Keep a record of whether this file was changed. 6. **Final Report:** Announce the completion of the synchronization process and provide a summary of the actions taken. @@ -146,34 +166,41 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai 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. -2. **Ask for User Choice:** You MUST prompt the user with the available options for the completed track. - > "Track '' is now complete. What would you like to do? - > A. **Review (Recommended):** Run the review command to verify changes before finalizing. - > B. **Archive:** Move the track's folder to `conductor/archive/` and remove it from the tracks file. - > C. **Delete:** Permanently delete the track's folder and remove it from the tracks file. - > D. **Skip:** Do nothing and leave it in the tracks file. - > Please enter the option of your choice (A, B, C, or D)." +2. **Ask for User Choice:** Immediately call the `ask_user` tool to prompt the user (do not repeat the question in the chat): + - **questions:** + - **header:** "Track Cleanup" + - **question:** "Track '' is now complete. What would you like to do?" + - **type:** "choice" + - **multiSelect:** false + - **options:** + - Label: "Review", Description: "Run the review command to verify changes before finalizing." + - Label: "Archive", Description: "Move the track's folder to `conductor/archive/` and remove it from the tracks file." + - Label: "Delete", Description: "Permanently delete the track's folder and remove it from the tracks file." + - Label: "Skip", Description: "Do nothing and leave it in the tracks file." 3. **Handle User Response:** - * **If user chooses "A" (Review):** + * **If user chooses "Review":** * Announce: "Please run `/conductor:review` to verify your changes. You will be able to archive or delete the track after the review." - * **If user chooses "B" (Archive):** + * **If user chooses "Archive":** i. **Create Archive Directory:** Check for the existence of `conductor/archive/`. If it does not exist, create it. ii. **Archive Track Folder:** Move the track's folder from its current location (resolved via the **Tracks Directory**) to `conductor/archive/`. 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. iv. **Commit Changes:** Stage the **Tracks Registry** file and `conductor/archive/`. Commit with the message `chore(conductor): Archive track ''`. v. **Announce Success:** Announce: "Track '' has been successfully archived." - * **If user chooses "C" (Delete):** - i. **CRITICAL WARNING:** Before proceeding, you MUST ask for a final confirmation due to the irreversible nature of the action. - > "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)" + * **If user chooses "Delete":** + i. **CRITICAL WARNING:** Before proceeding, immediately call the `ask_user` tool to ask for final confirmation (do not repeat the warning in the chat): + - **questions:** + - **header:** "Confirm" + - **question:** "WARNING: This will permanently delete the track folder and all its contents. This action cannot be undone. Are you sure?" + - **type:** "yesno" ii. **Handle Confirmation:** - **If 'yes'**: a. **Delete Track Folder:** Resolve the **Tracks Directory** and permanently delete the track's folder from `/`. 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. c. **Commit Changes:** Stage the **Tracks Registry** file and the deletion of the track directory. Commit with the message `chore(conductor): Delete track ''`. d. **Announce Success:** Announce: "Track '' has been permanently deleted." - - **If 'no' (or anything else)**: + - **If 'no'**: a. **Announce Cancellation:** Announce: "Deletion cancelled. The track has not been changed." - * **If user chooses "D" (Skip) or provides any other input:** + * **If user chooses "Skip":** * Announce: "Okay, the completed track will remain in your tracks file for now." -""" +""" \ No newline at end of file diff --git a/commands/conductor/newTrack.toml b/commands/conductor/newTrack.toml index af631fe..9d8524d 100644 --- a/commands/conductor/newTrack.toml +++ b/commands/conductor/newTrack.toml @@ -30,8 +30,12 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai 1. **Load Project Context:** Read and understand the content of the project documents (**Product Definition**, **Tech Stack**, etc.) resolved via the **Universal File Resolution Protocol**. 2. **Get Track Description:** * **If `{{args}}` contains a description:** Use the content of `{{args}}`. - * **If `{{args}}` is empty:** Ask the user: - > "Please provide a brief description of the track (feature, bug fix, chore, etc.) you wish to start." + * **If `{{args}}` is empty:** Ask the user using the `ask_user` tool: + - **questions:** + - **header:** "Description" + - **type:** "text" + - **question:** "Please provide a brief description of the track (feature, bug fix, chore, etc.) you wish to start." + - **placeholder:** "e.g., Implement user authentication" Await the user's response and use it as the track description. 3. **Infer Track Type:** Analyze the description to determine if it is a "Feature" or "Something Else" (e.g., Bug, Chore, Refactor). Do NOT ask the user to classify it. @@ -40,48 +44,52 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai 1. **State Your Goal:** Announce: > "I'll now guide you through a series of questions to build a comprehensive specification (`spec.md`) for this track." -2. **Questioning Phase:** Ask a series of questions to gather details for the `spec.md`. Tailor questions based on the track type (Feature or Other). - * **CRITICAL:** You MUST ask these questions sequentially (one by one). Do not ask multiple questions in a single turn. Wait for the user's response after each question. +2. **Questioning Phase:** Ask a series of questions to gather details for the `spec.md` using the `ask_user` tool. You must batch up to 4 related questions in a single tool call to streamline the process. Tailor questions based on the track type (Feature or Other). + * **CRITICAL:** Wait for the user's response after each `ask_user` tool call. * **General Guidelines:** * Refer to information in **Product Definition**, **Tech Stack**, etc., to ask context-aware questions. * Provide a brief explanation and clear examples for each question. - * **Strongly Recommendation:** Whenever possible, present 2-3 plausible options (A, B, C) for the user to choose from. - * **Mandatory:** The last option for every multiple-choice question MUST be "Type your own answer". - + * **Strongly Recommendation:** Whenever possible, present 2-3 plausible options for the user to choose from. + * **1. Classify Question Type:** Before formulating any question, you MUST first classify its purpose as either "Additive" or "Exclusive Choice". * Use **Additive** for brainstorming and defining scope (e.g., users, goals, features, project guidelines). These questions allow for multiple answers. * Use **Exclusive Choice** for foundational, singular commitments (e.g., selecting a primary technology, a specific workflow rule). These questions require a single answer. - - * **2. Formulate the Question:** Based on the classification, you MUST adhere to the following: - * **Strongly Recommended:** Whenever possible, present 2-3 plausible options (A, B, C) for the user to choose from. - * **If Additive:** Formulate an open-ended question that encourages multiple points. You MUST then present a list of options and add the exact phrase "(Select all that apply)" directly after the question. - * **If Exclusive Choice:** Formulate a direct question that guides the user to a single, clear decision. You MUST NOT add "(Select all that apply)". + + * **2. Formulate the Question:** Use the `ask_user` tool: Adhere to the following for each question in the `questions` array: + - **header:** Very short label (max 16 chars). + - **type:** "choice", "text", or "yesno". + - **multiSelect:** (Required for type: "choice") Set to `true` for multi-select (additive) or `false` for single-choice (exclusive). + - **options:** (Required for type: "choice") Provide 2-4 options, each with a `label` and `description`. Note that "Other" is automatically added. + - **placeholder:** (For type: "text") Provide a hint. * **3. Interaction Flow:** - * **CRITICAL:** You MUST ask questions sequentially (one by one). Do not ask multiple questions in a single turn. Wait for the user's response after each question. - * The last option for every multiple-choice question MUST be "Type your own answer". - * Confirm your understanding by summarizing before moving on to the next question or section.. + * Wait for the user's response after each `ask_user` tool call. + * If the user selects "Other", use a subsequent `ask_user` tool call with `type: "text"` to get their input if necessary. + * Confirm your understanding by summarizing before moving on to drafting. * **If FEATURE:** - * **Ask 3-5 relevant questions** to clarify the feature request. + * **Ask 3-4 relevant questions** to clarify the feature request using the `ask_user` tool. * Examples include clarifying questions about the feature, how it should be implemented, interactions, inputs/outputs, etc. * Tailor the questions to the specific feature request (e.g., if the user didn't specify the UI, ask about it; if they didn't specify the logic, ask about it). * **If SOMETHING ELSE (Bug, Chore, etc.):** - * **Ask 2-3 relevant questions** to obtain necessary details. + * **Ask 2-3 relevant questions** to obtain necessary details using the `ask_user` tool. * Examples include reproduction steps for bugs, specific scope for chores, or success criteria. * Tailor the questions to the specific request. 3. **Draft `spec.md`:** Once sufficient information is gathered, draft the content for the track's `spec.md` file, including sections like Overview, Functional Requirements, Non-Functional Requirements (if any), Acceptance Criteria, and Out of Scope. -4. **User Confirmation:** Present the drafted `spec.md` content to the user for review and approval. - > "I've drafted the specification for this track. Please review the following:" - > - > ```markdown - > [Drafted spec.md content here] - > ``` - > - > "Does this accurately capture the requirements? Please suggest any changes or confirm." +4. **User Confirmation:** + - **Present Content:** First, display the drafted `spec.md` content to the user in the chat. + - **Ask for Approval:** Then, use the `ask_user` tool to request confirmation: + - **questions:** + - **header:** "Confirm Spec" + - **question:** "Does this accurately capture the requirements?" + - **type:** "choice" + - **multiSelect:** false + - **options:** + - Label: "Approve", Description: "The specification looks correct, proceed to planning." + - Label: "Revise", Description: "I want to make changes to the requirements." Await user feedback and revise the `spec.md` content until confirmed. ### 2.3 Interactive Plan Generation (`plan.md`) @@ -99,14 +107,17 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai - Sub-task: ` - [ ] ...` * **CRITICAL: Inject Phase Completion Tasks.** Determine if a "Phase Completion Verification and Checkpointing Protocol" is defined in the **Workflow**. If this protocol exists, then for each **Phase** that you generate in `plan.md`, you MUST append a final meta-task to that phase. The format for this meta-task is: `- [ ] Task: Conductor - User Manual Verification '' (Protocol in workflow.md)`. -3. **User Confirmation:** Present the drafted `plan.md` to the user for review and approval. - > "I've drafted the implementation plan. Please review the following:" - > - > ```markdown - > [Drafted plan.md content here] - > ``` - > - > "Does this plan look correct and cover all the necessary steps based on the spec and our workflow? Please suggest any changes or confirm." +3. **User Confirmation:** + - **Present Content:** First, display the drafted `plan.md` content to the user in the chat. + - **Ask for Approval:** Then, use the `ask_user` tool to request confirmation: + - **questions:** + - **header:** "Confirm Plan" + - **question:** "Does this plan look correct and cover all the necessary steps?" + - **type:** "choice" + - **multiSelect:** false + - **options:** + - Label: "Approve", Description: "The plan looks solid, proceed to implementation." + - Label: "Revise", Description: "I want to modify the implementation steps." Await user feedback and revise the `plan.md` content until confirmed. ### 2.4 Create Track Artifacts and Update Main Plan diff --git a/commands/conductor/revert.toml b/commands/conductor/revert.toml index 478b2c0..0ee2943 100644 --- a/commands/conductor/revert.toml +++ b/commands/conductor/revert.toml @@ -37,42 +37,35 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai * **PATH A: Direct Confirmation** 1. Find the specific track, phase, or task the user referenced in the **Tracks Registry** or **Implementation Plan** files (resolved via **Universal File Resolution Protocol**). - 2. Ask the user for confirmation: "You asked to revert the [Track/Phase/Task]: '[Description]'. Is this correct?". - - **Structure:** - A) Yes - B) No - 3. If "yes", establish this as the `target_intent` and proceed to Phase 2. If "no", ask clarifying questions to find the correct item to revert. + 2. Immediately call the `ask_user` tool to confirm the selection (do not repeat the question in the chat): + - **questions:** + - **header:** "Confirm" + - **question:** "You asked to revert the [Track/Phase/Task]: '[Description]'. Is this correct?" + - **type:** "yesno" + 3. If "yes", establish this as the `target_intent` and proceed to Phase 2. If "no", immediately call the `ask_user` tool to ask clarifying questions (do not repeat the question in the chat): + - **questions:** + - **header:** "Clarify" + - **question:** "I'm sorry, I misunderstood. Please describe the Track, Phase, or Task you would like to revert." + - **type:** "text" * **PATH B: Guided Selection Menu** 1. **Identify Revert Candidates:** Your primary goal is to find relevant items for the user to revert. * **Scan All Plans:** You MUST read the **Tracks Registry** and every track's **Implementation Plan** (resolved via **Universal File Resolution Protocol** using the track's index file). - * **Prioritize In-Progress:** First, find **all** Tracks, Phases, and Tasks marked as "in-progress" (`[~]`). - * **Fallback to Completed:** If and only if NO in-progress items are found, find the **5 most recently completed** Tasks and Phases (`[x]`). - 2. **Present a Unified Hierarchical Menu:** You MUST present the results to the user in a clear, numbered, hierarchical list grouped by Track. The introductory text MUST change based on the context. - * **Example when in-progress items are found:** - > "I found multiple in-progress items. Please choose which one to revert: - > - > Track: track_20251208_user_profile - > 1) [Phase] Implement Backend API - > 2) [Task] Update user model - > - > 3) A different Track, Task, or Phase." - * **Example when showing recently completed items:** - > "No items are in progress. Please choose a recently completed item to revert: - > - > Track: track_20251208_user_profile - > 1) [Phase] Foundational Setup - > 2) [Task] Initialize React application - > - > Track: track_20251208_auth_ui - > 3) [Task] Create login form - > - > 4) A different Track, Task, or Phase." + * **Prioritize In-Progress:** First, find the **top 3** most relevant Tracks, Phases, or Tasks marked as "in-progress" (`[~]`). + * **Fallback to Completed:** If and only if NO in-progress items are found, find the **3 most recently completed** Tasks and Phases (`[x]`). + 2. **Present a Unified Hierarchical Menu:** Immediately call the `ask_user` tool to present the results (do not list them in the chat first): + - **questions:** + - **header:** "Select Item" + - **question:** "I found multiple in-progress items (or recently completed items). Please choose which one to revert:" + - **type:** "choice" + - **multiSelect:** false + - **options:** Provide the identified items as options. Group them by Track in the description if possible. **CRITICAL:** You MUST limit this array to a maximum of 4 items. + - **Example Option Label:** "[Task] Update user model", **Description:** "Track: track_20251208_user_profile" + - **Example Option Label:** "[Phase] Implement Backend", **Description:** "Track: track_20251208_user_profile" + - **Note:** The "Other" option is automatically added by the tool. 3. **Process User's Choice:** - * If the user's response is **A** or **B**, set this as the `target_intent` and proceed directly to Phase 2. - * If the user's response is **C** or another value that does not match A or B, you must engage in a dialogue to find the correct target. Ask clarifying questions like: - * "What is the name or ID of the track you are looking for?" - * "Can you describe the task you want to revert?" + * If the user selects a specific item from the list, set this as the `target_intent` and proceed directly to Phase 2. + * If the user selects "Other" (automatically added for "choice") or the explicit "Other" option provided, you must engage in a dialogue to find the correct target using `ask_user` tool with a single question of `type: "text"` in the `questions` array. * Once a target is identified, loop back to Path A for final confirmation. 4. **Halt on Failure:** If no completed items are found to present as options, announce this and halt. @@ -112,11 +105,23 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai > ` - ('conductor(plan): Mark task complete')` > * **Action:** I will run `git revert` on these commits in reverse order. -2. **Final Go/No-Go:** Ask for final confirmation: "**Do you want to proceed? (yes/no)**". - - **Structure:** - A) Yes - B) No - 3. If "yes", proceed to Phase 4. If "no", ask clarifying questions to get the correct plan for revert. +2. **Final Go/No-Go:** Immediately call the `ask_user` tool to ask for final confirmation (do not repeat the question in the chat): + - **questions:** + - **header:** "Confirm Plan" + - **question:** "Do you want to proceed with the drafted plan?" + - **type:** "choice" + - **multiSelect:** false + - **options:** + - Label: "Approve", Description: "Proceed with the revert actions." + - Label: "Revise", Description: "I want to change the revert plan." + +3. **Process User Choice:** + - If "Approve", proceed to Phase 4. + - If "Revise", immediately call the `ask_user` tool to get the correct plan (do not repeat the question in the chat): + - **questions:** + - **header:** "Revise" + - **question:** "Please describe the changes needed for the revert plan." + - **type:** "text" --- diff --git a/commands/conductor/review.toml b/commands/conductor/review.toml index 17304f1..3a3e091 100644 --- a/commands/conductor/review.toml +++ b/commands/conductor/review.toml @@ -41,9 +41,22 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai 2. **Auto-Detect Scope:** - If no input, read the **Tracks Registry**. - Look for a track marked as `[~] In Progress`. - - If one exists, ask the user: "Do you want to review the in-progress track ''? (yes/no)" - - If no track is in progress, or user says "no", ask: "What would you like to review? (Enter a track name, or typing 'current' for uncommitted changes)" -3. **Confirm Scope:** Ensure you and the user agree on what is being reviewed. + - If one exists, immediately call the `ask_user` tool to confirm (do not repeat the question in the chat): + - **questions:** + - **header:** "Review Track" + - **question:** "Do you want to review the in-progress track ''?" + - **type:** "yesno" + - If no track is in progress, or user says "no", immediately call the `ask_user` tool to ask for the scope (do not repeat the question in the chat): + - **questions:** + - **header:** "Select Scope" + - **question:** "What would you like to review?" + - **type:** "text" + - **placeholder:** "Enter track name, or 'current' for uncommitted changes" +3. **Confirm Scope:** Ensure you and the user agree on what is being reviewed by immediately calling the `ask_user` tool (do not repeat the question in the chat): + - **questions:** + - **header:** "Confirm Scope" + - **question:** "I will review: ''. Is this correct?" + - **type:** "yesno" ### 2.2 Retrieve Context 1. **Load Project Context:** @@ -61,7 +74,11 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai - Run `git diff ` to get the full context in one go. - Proceed to "Analyze and Verify". - **Large Changes (> 300 lines):** - - **Announce:** "Use 'Iterative Review Mode' due to change size." + - **Confirm:** Immediately call the `ask_user` tool to confirm before proceeding with a large review (do not repeat in chat): + - **questions:** + - **header:** "Large Review" + - **question:** "This review involves >300 lines of changes. I will use 'Iterative Review Mode' which may take longer. Proceed?" + - **type:** "yesno" - **List Files:** Run `git diff --name-only `. - **Iterate:** For each source file (ignore locks/assets): 1. Run `git diff -- `. @@ -82,7 +99,13 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai 4. **Testing:** - Are there new tests? - Do the changes look like they are covered by existing tests? - - *Action:* **Execute the test suite automatically.** Infer the test command based on the codebase languages and structure (e.g., `npm test`, `pytest`, `go test`). Run it. Analyze the output for failures. + - *Action:* **Execute the test suite automatically.** Infer the test command based on the codebase languages and structure (e.g., `npm test`, `pytest`, `go test`). + - If the test command is ambiguous or cannot be inferred, immediately call the `ask_user` tool to ask for it (do not repeat the question in the chat): + - **questions:** + - **header:** "Test Command" + - **question:** "I couldn't infer the test command. Please provide the command to run tests." + - **type:** "text" + - Run it. Analyze the output for failures. ### 2.4 Output Findings **Format your output strictly as follows:** @@ -114,45 +137,103 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai --- ## 3.0 COMPLETION PHASE -1. **Review Decision:** - - **Determine Recommendation:** - - If **Critical** or **High** issues found: "Recommend **CHANGES REQUESTED**." - - If only **Medium/Low** issues found: "Recommend **APPROVE WITH COMMENTS**." - - If no issues found: "Recommend **APPROVE**." - - **Action:** - - **If issues found:** Ask: - > "Do you want me to apply the suggested fixes, fix them manually yourself, or proceed to complete the track? - > A. **Apply Fixes:** Automatically apply the suggested code changes. - > B. **Manual Fix:** Stop so you can fix issues yourself. - > C. **Complete Track:** Ignore warnings and proceed to cleanup. - > Please enter your choice (A, B, or C)." - - **If "A" (Apply Fixes):** Apply the code modifications suggested in the findings using file editing tools. Then Proceed to next step. - - **If "B" (Manual Fix):** Terminate operation to allow user to edit code. - - **If "C" (Complete Track):** Proceed to the next step. - - **If no issues found:** Proceed to the next step. - -2. **Track Cleanup:** - **PROTOCOL: Offer to archive or delete the reviewed track.** - - a. **Context Check:** If you are NOT reviewing a specific track (e.g., just reviewing current changes without a track context), SKIP this entire section. - - b. **Ask for User Choice:** - > "Review complete. What would you like to do with track ''? - > A. **Archive:** Move to `conductor/archive/` and update registry. - > B. **Delete:** Permanently remove from system. - > C. **Skip:** Leave as is. - > Please enter your choice (A, B, or C)." - - c. **Handle User Response:** - * **If "A" (Archive):** - i. **Setup:** Ensure `conductor/archive/` exists. - ii. **Move:** Move track folder to `conductor/archive/`. - iii. **Update Registry:** Remove track section from **Tracks Registry**. - iv. **Commit:** Stage registry and archive. Commit: `chore(conductor): Archive track ''`. - v. **Announce:** "Track '' archived." - * **If "B" (Delete):** - i. **Confirm:** "WARNING: Irreversible deletion. Proceed? (yes/no)" - ii. **If yes:** Delete track folder, remove from **Tracks Registry**, commit (`chore(conductor): Delete track ''`), announce success. - iii. **If no:** Cancel. - * **If "C" (Skip):** Leave track as is. + +### 3.1 Review Decision +1. **Determine Recommendation and announce it to the user:** + - If **Critical** or **High** issues found: + - Announce: "I recommend we fix the important issues I found before moving forward." + - If only **Medium/Low** issues found: + - Announce: "The changes look good overall, but I have a few suggestions to improve them." + - If no issues found: + - Announce: "Everything looks great! I don't see any issues." +2. **Action:** + - **If issues found:** Immediately call the `ask_user` tool (do not repeat in chat): + - **questions:** + - **header:** "Decision" + - **question:** "How would you like to proceed with the findings?" + - **type:** "choice" + - **multiSelect:** false + - **options:** + - Label: "Apply Fixes", Description: "Automatically apply the suggested code changes." + - Label: "Manual Fix", Description: "Stop so you can fix issues yourself." + - Label: "Complete Track", Description: "Ignore warnings and proceed to cleanup." + - **If "Apply Fixes":** Apply the code modifications suggested in the findings using file editing tools. Then Proceed to next step. + - **If "Manual Fix":** Terminate operation to allow user to edit code. + - **If "Complete Track":** Proceed to the next step. + - **If no issues found:** Proceed to the next step. + +### 3.2 Commit Review Changes +**PROTOCOL: Ensure all review-related changes are committed and tracked in the plan.** + +1. **Check for Changes:** Use `git status --porcelain` to check for any uncommitted changes (staged or unstaged) in the repository. +2. **Condition for Action:** + - If NO changes are detected, proceed to '3.3 Track Cleanup'. + - If changes are detected: + a. **Check for Track Context:** + - If you are NOT reviewing a specific track (i.e., you don't have a `plan.md` in context), immediately call the `ask_user` tool (do not repeat in chat): + - **questions:** + - **header:** "Commit Changes" + - **question:** "I've detected uncommitted changes. Should I commit them?" + - **type:** "yesno" + - If 'yes', stage all changes and commit with `fix(conductor): Apply review suggestions `. + - Proceed to '3.3 Track Cleanup'. + b. **Handle Track-Specific Changes:** + i. **Confirm with User:** Immediately call the `ask_user` tool (do not repeat in chat): + - **questions:** + - **header:** "Commit & Track" + - **question:** "I've detected uncommitted changes from the review process. Should I commit these and update the track's plan?" + - **type:** "yesno" + ii. **If Yes:** + - **Update Plan (Add Review Task):** + - Read the track's `plan.md`. + - Append a new phase (if it doesn't exist) and task to the end of the file. + - **Format:** + ```markdown + ## Phase: Review Fixes + - [~] Task: Apply review suggestions + ``` + - **Commit Code:** + - Stage all code changes related to the track (excluding `plan.md`). + - Commit with message: `fix(conductor): Apply review suggestions for track ''`. + - **Record SHA:** + - Get the short SHA (first 7 characters) of the commit. + - Update the task in `plan.md` to: `- [x] Task: Apply review suggestions `. + - **Commit Plan Update:** + - Stage `plan.md`. + - Commit with message: `conductor(plan): Mark task 'Apply review suggestions' as complete`. + - **Announce Success:** "Review changes committed and tracked in the plan." + iii. **If No:** Skip the commit and plan update. Proceed to '3.3 Track Cleanup'. + +### 3.3 Track Cleanup +**PROTOCOL: Offer to archive or delete the reviewed track.** + +1. **Context Check:** If you are NOT reviewing a specific track (e.g., just reviewing current changes without a track context), SKIP this entire section. + +2. **Ask for User Choice:** Immediately call the `ask_user` tool to prompt the user (do not repeat the question in the chat): + - **questions:** + - **header:** "Track Cleanup" + - **question:** "Review complete. What would you like to do with track ''?" + - **type:** "choice" + - **multiSelect:** false + - **options:** + - Label: "Archive", Description: "Move the track's folder to `conductor/archive/` and remove it from the tracks file." + - Label: "Delete", Description: "Permanently delete the track's folder and remove it from the tracks file." + - Label: "Skip", Description: "Do nothing and leave it in the tracks file." + +3. **Handle User Response:** + * **If "Archive":** + i. **Setup:** Ensure `conductor/archive/` exists. + ii. **Move:** Move track folder to `conductor/archive/`. + iii. **Update Registry:** Remove track section from **Tracks Registry**. + iv. **Commit:** Stage registry and archive. Commit: `chore(conductor): Archive track ''`. + v. **Announce:** "Track '' archived." + * **If "Delete":** + i. **Confirm:** Immediately call the `ask_user` tool to ask for final confirmation (do not repeat the warning in the chat): + - **questions:** + - **header:** "Confirm" + - **question:** "WARNING: This is an irreversible deletion. Do you want to proceed?" + - **type:** "yesno" + ii. **If yes:** Delete track folder, remove from **Tracks Registry**, commit (`chore(conductor): Delete track ''`), announce success. + iii. **If no:** Cancel. + * **If "Skip":** Leave track as is. """ diff --git a/commands/conductor/setup.toml b/commands/conductor/setup.toml index 2f6850c..33a4e63 100644 --- a/commands/conductor/setup.toml +++ b/commands/conductor/setup.toml @@ -9,7 +9,20 @@ CRITICAL: When determining model complexity, ALWAYS select the "flash" model, re --- -## 1.1 BEGIN `RESUME` CHECK +## 1.1 PRE-INITIALIZATION OVERVIEW +1. **Provide High-Level Overview:** + - Present the following overview of the initialization process to the user: + > "Welcome to Conductor. I will guide you through the following steps to set up your project: + > 1. **Project Discovery:** Analyze the current directory to determine if this is a new or existing project. + > 2. **Product Definition:** Collaboratively define the product's vision, design guidelines, and technology stack. + > 3. **Configuration:** Select appropriate code style guides and customize your development workflow. + > 4. **Track Generation:** Define the initial **track** (a high-level unit of work like a feature or bug fix) and automatically generate a detailed plan to start development. + > + > Let's get started!" + +--- + +## 1.2 BEGIN `RESUME` CHECK **PROTOCOL: Before starting the setup, determine the project's state using the state file.** 1. **Read State File:** Check for the existence of `conductor/setup_state.json`. @@ -32,19 +45,6 @@ CRITICAL: When determining model complexity, ALWAYS select the "flash" model, re --- -## 1.2 PRE-INITIALIZATION OVERVIEW -1. **Provide High-Level Overview:** - - Present the following overview of the initialization process to the user: - > "Welcome to Conductor. I will guide you through the following steps to set up your project: - > 1. **Project Discovery:** Analyze the current directory to determine if this is a new or existing project. - > 2. **Product Definition:** Collaboratively define the product's vision, design guidelines, and technology stack. - > 3. **Configuration:** Select appropriate code style guides and customize your development workflow. - > 4. **Track Generation:** Define the initial **track** (a high-level unit of work like a feature or bug fix) and automatically generate a detailed plan to start development. - > - > Let's get started!" - ---- - ## 2.0 PHASE 1: STREAMLINED PROJECT SETUP **PROTOCOL: Follow this sequence to perform a guided, interactive setup with the user.** @@ -68,11 +68,10 @@ CRITICAL: When determining model complexity, ALWAYS select the "flash" model, re - **Begin Brownfield Project Initialization Protocol:** - **1.0 Pre-analysis Confirmation:** 1. **Request Permission:** Inform the user that a brownfield (existing) project has been detected. - 2. **Ask for Permission:** Request permission for a read-only scan to analyze the project with the following options using the next structure: - > A) Yes - > B) No - > - > Please respond with A or B. + 2. **Ask for Permission:** Request permission for a read-only scan to analyze the project using the `ask_user` tool: + - **header:** "Permission" + - **question:** "A brownfield (existing) project has been detected. May I perform a read-only scan to analyze the project?" + - **type:** "yesno" 3. **Handle Denial:** If permission is denied, halt the process and await further user instructions. 4. **Confirmation:** Upon confirmation, proceed to the next step. @@ -105,7 +104,11 @@ CRITICAL: When determining model complexity, ALWAYS select the "flash" model, re - If a `.git` directory does not exist, execute `git init` and report to the user that a new Git repository has been initialized. 4. **Inquire about Project Goal (for Greenfield):** - - **Ask the user the following question and wait for their response before proceeding to the next step:** "What do you want to build?" + - **Ask the user the following question using the `ask_user` tool and wait for their response before proceeding to the next step:** + - **header:** "Project Goal" + - **type:** "text" + - **question:** "What do you want to build?" + - **placeholder:** "e.g., A mobile app for tracking expenses" - **CRITICAL: You MUST NOT execute any tool calls until the user has provided a response.** - **Upon receiving the user's response:** - Execute `mkdir -p conductor`. @@ -117,156 +120,142 @@ CRITICAL: When determining model complexity, ALWAYS select the "flash" model, re ### 2.1 Generate Product Guide (Interactive) 1. **Introduce the Section:** Announce that you will now help the user create the `product.md`. -2. **Ask Questions Sequentially:** Ask one question at a time. Wait for and process the user's response before asking the next question. Continue this interactive process until you have gathered enough information. - - **CONSTRAINT:** Limit your inquiry to a maximum of 5 questions. - - **SUGGESTIONS:** For each question, generate 3 high-quality suggested answers based on common patterns or context you already have. - - **Example Topics:** Target users, goals, features, etc - * **General Guidelines:** - * **1. Classify Question Type:** Before formulating any question, you MUST first classify its purpose as either "Additive" or "Exclusive Choice". - * Use **Additive** for brainstorming and defining scope (e.g., users, goals, features, project guidelines). These questions allow for multiple answers. - * Use **Exclusive Choice** for foundational, singular commitments (e.g., selecting a primary technology, a specific workflow rule). These questions require a single answer. - - * **2. Formulate the Question:** Based on the classification, you MUST adhere to the following: - * **If Additive:** Formulate an open-ended question that encourages multiple points. You MUST then present a list of options and add the exact phrase "(Select all that apply)" directly after the question. - * **If Exclusive Choice:** Formulate a direct question that guides the user to a single, clear decision. You MUST NOT add "(Select all that apply)". - - * **3. Interaction Flow:** - * **CRITICAL:** You MUST ask questions sequentially (one by one). Do not ask multiple questions in a single turn. Wait for the user's response after each question. - * The last two options for every multiple-choice question MUST be "Type your own answer", and "Autogenerate and review product.md". - * Confirm your understanding by summarizing before moving on. - - **Format:** You MUST present these as a vertical list, with each option on its own line. - - **Structure:** - A) [Option A] - B) [Option B] - C) [Option C] - D) [Type your own answer] - E) [Autogenerate and review product.md] - - **FOR EXISTING PROJECTS (BROWNFIELD):** Ask project context-aware questions based on the code analysis. - - **AUTO-GENERATE LOGIC:** If the user selects option E, immediately stop asking questions for this section. Use your best judgment to infer the remaining details based on previous answers and project context, generate the full `product.md` content, write it to the file, and proceed to the next section. -3. **Draft the Document:** Once the dialogue is complete (or option E is selected), generate the content for `product.md`. If option E was chosen, use your best judgment to infer the remaining details based on previous answers and project context. You are encouraged to expand on the gathered details to create a comprehensive document. - - **CRITICAL:** The source of truth for generation is **only the user's selected answer(s)**. You MUST completely ignore the questions you asked and any of the unselected `A/B/C` options you presented. - - **Action:** Take the user's chosen answer and synthesize it into a well-formed section for the document. You are encouraged to expand on the user's choice to create a comprehensive and polished output. DO NOT include the conversational options (A, B, C, D, E) in the final file. -4. **User Confirmation Loop:** Present the drafted content to the user for review and begin the confirmation loop. - > "I've drafted the product guide. Please review the following:" - > - > ```markdown - > [Drafted product.md content here] - > ``` - > - > "What would you like to do next? - > A) **Approve:** The document is correct and we can proceed. - > B) **Suggest Changes:** Tell me what to modify. - > - > You can always edit the generated file with the Gemini CLI built-in option "Modify with external editor" (if present), or with your favorite external editor after this step. - > Please respond with A or B." - - **Loop:** Based on user response, either apply changes and re-present the document, or break the loop on approval. -5. **Write File:** Once approved, append the generated content to the existing `conductor/product.md` file, preserving the `# Initial Concept` section. -6. **Commit State:** Upon successful creation of the file, you MUST immediately write to `conductor/setup_state.json` with the exact content: +2. **Determine Mode:** Use the `ask_user` tool to let the user choose their preferred workflow. + - **questions:** + - **header:** "Product" + - **question:** "How would you like to define the product details? Whether you prefer a quick start or a deep dive, both paths lead to a high-quality product guide!" + - **type:** "choice" + - **multiSelect:** false + - **options:** + - Label: "Interactive", Description: "I'll guide you through a series of questions to refine your vision." + - Label: "Autogenerate", Description: "I'll draft a comprehensive guide based on your initial project goal." + +3. **Gather Information (Conditional):** + - **If user chose "Autogenerate":** Skip this step and proceed directly to **Step 4 (Draft the Document)**. + - **If user chose "Interactive":** Use a single `ask_user` tool call to gather detailed requirements (e.g., target users, goals, features). + - **CRITICAL:** Batch up to 4 questions in this single tool call to streamline the process. + - **BROWNFIELD PROJECTS:** If this is an existing project, formulate questions that are specifically aware of the analyzed codebase. Do not ask generic questions if the answer is already in the files. + - **SUGGESTIONS:** For each question, generate 3 high-quality suggested answers based on common patterns or context. + - **Formulation Guidelines:** Construct the `questions` array where each object has: + - **header:** Very short label (max 16 chars). + - **type:** "choice". + - **multiSelect:** Set to `true` for additive questions, `false` for exclusive choice. + - **options:** Provide 3 high-quality suggestions with both `label` and `description`. Do NOT include an "Autogenerate" option here. + - **Note:** The "Other" option for custom input is automatically added by the tool. + - **Interaction Flow:** Wait for the user's response, then proceed to the next step. + +4. **Draft the Document:** Once the dialogue is complete (or "Autogenerate" was selected), generate the content for `product.md`. + - **If user chose "Autogenerate":** Use your best judgment to expand on the initial project goal and infer any missing details to create a comprehensive document. + - **If user chose "Interactive":** Use the specific answers provided. The source of truth is **only the user's selected answer(s)**. You are encouraged to expand on these choices to create a polished output. +5. **User Confirmation Loop:** + - **Present Content:** First, display the drafted `product.md` content to the user in the chat. + - **Ask for Approval:** Then, use the `ask_user` tool to request confirmation: + - **questions:** + - **header:** "Review" + - **question:** "Please review the drafted Product Guide above. What would you like to do next?" + - **type:** "choice" + - **multiSelect:** false + - **options:** + - Label: "Approve", Description: "The guide looks good, proceed to the next step." + - Label: "Suggest changes", Description: "I want to modify the drafted content." +6. **Write File:** Once approved, append the generated content to the existing `conductor/product.md` file, preserving the `# Initial Concept` section. +7. **Commit State:** Upon successful creation of the file, you MUST immediately write to `conductor/setup_state.json` with the exact content: `{"last_successful_step": "2.1_product_guide"}` -7. **Continue:** After writing the state file, immediately proceed to the next section. +8. **Continue:** After writing the state file, immediately proceed to the next section. ### 2.2 Generate Product Guidelines (Interactive) 1. **Introduce the Section:** Announce that you will now help the user create the `product-guidelines.md`. -2. **Ask Questions Sequentially:** Ask one question at a time. Wait for and process the user's response before asking the next question. Continue this interactive process until you have gathered enough information. - - **CONSTRAINT:** Limit your inquiry to a maximum of 5 questions. - - **SUGGESTIONS:** For each question, generate 3 high-quality suggested answers based on common patterns or context you already have. Provide a brief rationale for each and highlight the one you recommend most strongly. - - **Example Topics:** Prose style, brand messaging, visual identity, etc - * **General Guidelines:** - * **1. Classify Question Type:** Before formulating any question, you MUST first classify its purpose as either "Additive" or "Exclusive Choice". - * Use **Additive** for brainstorming and defining scope (e.g., users, goals, features, project guidelines). These questions allow for multiple answers. - * Use **Exclusive Choice** for foundational, singular commitments (e.g., selecting a primary technology, a specific workflow rule). These questions require a single answer. - - * **2. Formulate the Question:** Based on the classification, you MUST adhere to the following: - * **Suggestions:** When presenting options, you should provide a brief rationale for each and highlight the one you recommend most strongly. - * **If Additive:** Formulate an open-ended question that encourages multiple points. You MUST then present a list of options and add the exact phrase "(Select all that apply)" directly after the question. - * **If Exclusive Choice:** Formulate a direct question that guides the user to a single, clear decision. You MUST NOT add "(Select all that apply)". - - * **3. Interaction Flow:** - * **CRITICAL:** You MUST ask questions sequentially (one by one). Do not ask multiple questions in a single turn. Wait for the user's response after each question. - * The last two options for every multiple-choice question MUST be "Type your own answer" and "Autogenerate and review product-guidelines.md". - * Confirm your understanding by summarizing before moving on. - - **Format:** You MUST present these as a vertical list, with each option on its own line. - - **Structure:** - A) [Option A] - B) [Option B] - C) [Option C] - D) [Type your own answer] - E) [Autogenerate and review product-guidelines.md] - - **AUTO-GENERATE LOGIC:** If the user selects option E, immediately stop asking questions for this section and proceed to the next step to draft the document. -3. **Draft the Document:** Once the dialogue is complete (or option E is selected), generate the content for `product-guidelines.md`. If option E was chosen, use your best judgment to infer the remaining details based on previous answers and project context. You are encouraged to expand on the gathered details to create a comprehensive document. - **CRITICAL:** The source of truth for generation is **only the user's selected answer(s)**. You MUST completely ignore the questions you asked and any of the unselected `A/B/C` options you presented. - - **Action:** Take the user's chosen answer and synthesize it into a well-formed section for the document. You are encouraged to expand on the user's choice to create a comprehensive and polished output. DO NOT include the conversational options (A, B, C, D, E) in the final file. -4. **User Confirmation Loop:** Present the drafted content to the user for review and begin the confirmation loop. - > "I've drafted the product guidelines. Please review the following:" - > - > ```markdown - > [Drafted product-guidelines.md content here] - > ``` - > - > "What would you like to do next? - > A) **Approve:** The document is correct and we can proceed. - > B) **Suggest Changes:** Tell me what to modify. - > - > You can always edit the generated file with the Gemini CLI built-in option "Modify with external editor" (if present), or with your favorite external editor after this step. - > Please respond with A or B." - - **Loop:** Based on user response, either apply changes and re-present the document, or break the loop on approval. -5. **Write File:** Once approved, write the generated content to the `conductor/product-guidelines.md` file. -6. **Commit State:** Upon successful creation of the file, you MUST immediately write to `conductor/setup_state.json` with the exact content: +2. **Determine Mode:** Use the `ask_user` tool to let the user choose their preferred workflow. + - **questions:** + - **header:** "Prod Guidelines" + - **question:** "How would you like to define the product guidelines? You can hand-pick the style or let me generate a standard set." + - **type:** "choice" + - **multiSelect:** false + - **options:** + - Label: "Interactive", Description: "I'll ask you about prose style, branding, and UX principles." + - Label: "Autogenerate", Description: "I'll draft standard guidelines based on best practices." + +3. **Gather Information (Conditional):** + - **If user chose "Autogenerate":** Skip this step and proceed directly to **Step 4 (Draft the Document)**. + - **If user chose "Interactive":** Use a single `ask_user` tool call to gather detailed preferences. + - **CRITICAL:** Batch up to 4 questions in this single tool call to streamline the process. + - **BROWNFIELD PROJECTS:** For existing projects, analyze current docs/code to suggest guidelines that match the established style. + - **SUGGESTIONS:** For each question, generate 3 high-quality suggested answers based on common patterns or context. + - **Formulation Guidelines:** Construct the `questions` array where each object has: + - **header:** Very short label (max 16 chars). + - **type:** "choice". + - **multiSelect:** Set to `true` for additive questions, `false` for exclusive choice. + - **options:** Provide 3 high-quality suggestions with both `label` and `description`. Do NOT include an "Autogenerate" option here. + - **Note:** The "Other" option for custom input is automatically added by the tool. + - **Interaction Flow:** Wait for the user's response, then proceed to the next step. + +4. **Draft the Document:** Once the dialogue is complete (or "Autogenerate" was selected), generate the content for `product-guidelines.md`. + - **If user chose "Autogenerate":** Use your best judgment to infer standard, high-quality guidelines suitable for the project type. + - **If user chose "Interactive":** Use the specific answers provided. The source of truth is **only the user's selected answer(s)**. You are encouraged to expand on these choices to create a polished output. +5. **User Confirmation Loop:** + - **Present Content:** First, display the drafted `product-guidelines.md` content to the user in the chat. + - **Ask for Approval:** Then, use the `ask_user` tool to request confirmation: + - **questions:** + - **header:** "Review" + - **question:** "Please review the drafted Product Guidelines above. What would you like to do next?" + - **type:** "choice" + - **multiSelect:** false + - **options:** + - Label: "Approve", Description: "The guidelines look good, proceed to the next step." + - Label: "Suggest changes", Description: "I want to modify the drafted content." +6. **Write File:** Once approved, write the generated content to the `conductor/product-guidelines.md` file. +7. **Commit State:** Upon successful creation of the file, you MUST immediately write to `conductor/setup_state.json` with the exact content: `{"last_successful_step": "2.2_product_guidelines"}` -7. **Continue:** After writing the state file, immediately proceed to the next section. +8. **Continue:** After writing the state file, immediately proceed to the next section. ### 2.3 Generate Tech Stack (Interactive) -1. **Introduce the Section:** Announce that you will now help define the technology stacks. -2. **Ask Questions Sequentially:** Ask one question at a time. Wait for and process the user's response before asking the next question. Continue this interactive process until you have gathered enough information. - - **CONSTRAINT:** Limit your inquiry to a maximum of 5 questions. - - **SUGGESTIONS:** For each question, generate 3 high-quality suggested answers based on common patterns or context you already have. - - **Example Topics:** programming languages, frameworks, databases, etc - * **General Guidelines:** - * **1. Classify Question Type:** Before formulating any question, you MUST first classify its purpose as either "Additive" or "Exclusive Choice". - * Use **Additive** for brainstorming and defining scope (e.g., users, goals, features, project guidelines). These questions allow for multiple answers. - * Use **Exclusive Choice** for foundational, singular commitments (e.g., selecting a primary technology, a specific workflow rule). These questions require a single answer. - - * **2. Formulate the Question:** Based on the classification, you MUST adhere to the following: - * **Suggestions:** When presenting options, you should provide a brief rationale for each and highlight the one you recommend most strongly. - * **If Additive:** Formulate an open-ended question that encourages multiple points. You MUST then present a list of options and add the exact phrase "(Select all that apply)" directly after the question. - * **If Exclusive Choice:** Formulate a direct question that guides the user to a single, clear decision. You MUST NOT add "(Select all that apply)". - - * **3. Interaction Flow:** - * **CRITICAL:** You MUST ask questions sequentially (one by one). Do not ask multiple questions in a single turn. Wait for the user's response after each question. - * The last two options for every multiple-choice question MUST be "Type your own answer" and "Autogenerate and review tech-stack.md". - * Confirm your understanding by summarizing before moving on. - - **Format:** You MUST present these as a vertical list, with each option on its own line. - - **Structure:** - A) [Option A] - B) [Option B] - C) [Option C] - D) [Type your own answer] - E) [Autogenerate and review tech-stack.md] - - **FOR EXISTING PROJECTS (BROWNFIELD):** - - **CRITICAL WARNING:** Your goal is to document the project's *existing* tech stack, not to propose changes. - - **State the Inferred Stack:** Based on the code analysis, you MUST state the technology stack that you have inferred. Do not present any other options. - - **Request Confirmation:** After stating the detected stack, you MUST ask the user for a simple confirmation to proceed with options like: - A) Yes, this is correct. - B) No, I need to provide the correct tech stack. - - **Handle Disagreement:** If the user disputes the suggestion, acknowledge their input and allow them to provide the correct technology stack manually as a last resort. - - **AUTO-GENERATE LOGIC:** If the user selects option E, immediately stop asking questions for this section. Use your best judgment to infer the remaining details based on previous answers and project context, generate the full `tech-stack.md` content, write it to the file, and proceed to the next section. -3. **Draft the Document:** Once the dialogue is complete (or option E is selected), generate the content for `tech-stack.md`. If option E was chosen, use your best judgment to infer the remaining details based on previous answers and project context. You are encouraged to expand on the gathered details to create a comprehensive document. - - **CRITICAL:** The source of truth for generation is **only the user's selected answer(s)**. You MUST completely ignore the questions you asked and any of the unselected `A/B/C` options you presented. - - **Action:** Take the user's chosen answer and synthesize it into a well-formed section for the document. You are encouraged to expand on the user's choice to create a comprehensive and polished output. DO NOT include the conversational options (A, B, C, D, E) in the final file. -4. **User Confirmation Loop:** Present the drafted content to the user for review and begin the confirmation loop. - > "I've drafted the tech stack document. Please review the following:" - > - > ```markdown - > [Drafted tech-stack.md content here] - > ``` - > - > "What would you like to do next? - > A) **Approve:** The document is correct and we can proceed. - > B) **Suggest Changes:** Tell me what to modify. - > - > You can always edit the generated file with the Gemini CLI built-in option "Modify with external editor" (if present), or with your favorite external editor after this step. - > Please respond with A or B." - - **Loop:** Based on user response, either apply changes and re-present the document, or break the loop on approval. +1. **Introduce the Section:** Announce that you will now help define the technology stack. +2. **Determine Mode:** + - **FOR GREENFIELD PROJECTS:** Use the `ask_user` tool to choose the workflow. + - **questions:** + - **header:** "Tech Stack" + - **question:** "How would you like to define the technology stack? I can recommend a proven stack for your goal or you can hand-pick each component." + - **type:** "choice" + - **multiSelect:** false + - **options:** + - Label: "Interactive", Description: "I'll ask you to select the language, frameworks, and database." + - Label: "Autogenerate", Description: "I'll recommend a standard tech stack based on your project goal." + - **FOR BROWNFIELD PROJECTS:** + - **CRITICAL WARNING:** Your goal is to document the project's *existing* tech stack, not to propose changes. + - **State the Inferred Stack:** Based on the code analysis, you MUST state the technology stack that you have inferred in the chat. + - **Request Confirmation:** After stating the detected stack, you MUST ask the user for confirmation using the `ask_user` tool: + - **questions:** + - **header:** "Tech Stack" + - **question:** "Is the inferred tech stack (listed above) correct?" + - **type:** "yesno" + - **Handle Disagreement:** If the user disputes the suggestion, acknowledge their input and allow them to provide the correct technology stack manually using `ask_user` tool with `type: "text"`. + +3. **Gather Information (Greenfield Interactive Only):** + - **If user chose "Interactive":** Use a single `ask_user` tool call to gather detailed preferences. + - **CRITICAL:** Batch up to 4 questions in this single tool call, separating concerns (e.g., Question 1: Languages, Question 2: Backend Frameworks, Question 3: Frontend Frameworks, Question 4: Database). + - **SUGGESTIONS:** For each question, generate 3-4 high-quality suggested answers. + - **Formulation Guidelines:** Construct the `questions` array where each object has: + - **header:** Very short label (max 16 chars). + - **type:** "choice" + - **multiSelect:** Set to `true` (Additive) to allow hybrid stacks. + - **options:** Provide descriptive options with both `label` and `description`. Use the `label` field to explain *why* or *where* a technology fits (e.g., "Typescript - Ideal for Angular UI"). Ensure the options are coherent when combined. + - **Note:** Do NOT include an "Autogenerate" option here. + - **Interaction Flow:** Wait for the user's response, then proceed to the next step. + +4. **Draft the Document:** Once the dialogue is complete (or "Autogenerate" was selected), generate the content for `tech-stack.md`. + - **If user chose "Autogenerate":** Use your best judgment to infer a standard, high-quality stack suitable for the project goal. + - **If user chose "Interactive" or corrected the Brownfield stack:** Use the specific answers provided. The source of truth is **only the user's selected answer(s)**. +5. **User Confirmation Loop:** + - **Present Content:** First, display the drafted `tech-stack.md` content to the user in the chat. + - **Ask for Approval:** Then, use the `ask_user` tool to request confirmation: + - **questions:** + - **header:** "Review" + - **question:** "Please review the drafted Tech Stack above. What would you like to do next?" + - **type:** "choice" + - **multiSelect:** false + - **options:** + - Label: "Approve", Description: "The tech stack looks good, proceed to the next step." + - Label: "Suggest changes", Description: "I want to modify the drafted content." 6. **Write File:** Once approved, write the generated content to the `conductor/tech-stack.md` file. 7. **Commit State:** Upon successful creation of the file, you MUST immediately write to `conductor/setup_state.json` with the exact content: `{"last_successful_step": "2.3_tech_stack"}` @@ -276,48 +265,83 @@ CRITICAL: When determining model complexity, ALWAYS select the "flash" model, re 1. **Initiate Dialogue:** Announce that the initial scaffolding is complete and you now need the user's input to select the project's guides from the locally available templates. 2. **Select Code Style Guides:** - List the available style guides by running `ls ~/.gemini/extensions/conductor/templates/code_styleguides/`. - - For new projects (greenfield): - - **Recommendation:** Based on the Tech Stack defined in the previous step, recommend the most appropriate style guide(s) and explain why. - - Ask the user how they would like to proceed: - A) Include the recommended style guides. - B) Edit the selected set. - - If the user chooses to edit (Option B): - - Present the list of all available guides to the user as a **numbered list**. - - Ask the user which guide(s) they would like to copy. - - For existing projects (brownfield): + - **FOR GREENFIELD PROJECTS:** + - **Recommendation:** Based on the Tech Stack defined in the previous step, recommend the most appropriate style guide(s) (e.g., "python.md" for a Python project) and explain why. + - **Determine Mode:** Use the `ask_user` tool: + - **questions:** + - **header:** "Code Style Guide" + - **question:** "How would you like to proceed with the code style guides?" + - **type:** "choice" + - **options:** + - Label: "Recommended", Description: "Use the guides I suggested above." + - Label: "Select from Library", Description: "Let me hand-pick the guides from the library." + - **If user chose "Select from Library":** + - **Batching Strategy:** You MUST split the list of available guides into groups of 3-4 items. + - **Action:** Announce "I'll present the available guides in groups. Please select all that apply." Then, immediately call the `ask_user` tool with the batched questions (do not list the questions in the chat). + - **Single Tool Call:** Create one `ask_user` call containing a `questions` array with one question per group. + - **Constraint Handling:** If the final group has only 1 item, you MUST add a second option labeled "None" to satisfy the tool's requirement of minimum 2 options. + - **Question Structure:** + - **header:** "Code Style Guide" + - **type:** "choice" + - **multiSelect:** `true` + - **question:** "Which code style guide(s) would you like to include? (Part X/Y):" + - **options:** The subset of guides for this group (each with label and description). + + - **FOR BROWNFIELD PROJECTS:** - **Announce Selection:** Inform the user: "Based on the inferred tech stack, I will copy the following code style guides: ." - - **Ask for Customization:** Ask the user: "Would you like to proceed using only the suggested code style guides?" - - Ask the user for a simple confirmation to proceed with options like: - A) Yes, I want to proceed with the suggested code style guides. - B) No, I want to add more code style guides. - - **Action:** Construct and execute a command to create the directory and copy all selected files. For example: `mkdir -p conductor/code_styleguides && cp ~/.gemini/extensions/conductor/templates/code_styleguides/python.md ~/.gemini/extensions/conductor/templates/code_styleguides/javascript.md conductor/code_styleguides/` - - **Commit State:** Upon successful completion of the copy command, you MUST immediately write to `conductor/setup_state.json` with the exact content: - `{"last_successful_step": "2.4_code_styleguides"}` + - **Determine Mode:** Use the `ask_user` tool: + - **questions:** + - **header:** "Code Style Guide" + - **question:** "I've identified these guides for your project. Would you like to proceed or add more?" + - **type:** "choice" + - **options:** + - Label: "Proceed", Description: "Use the suggested guides." + - Label: "Add More", Description: "Select additional guides from the library." + - **If user chose "Add More":** + - **Action:** Announce "I'll present the additional guides. Please select all that apply." Then, immediately call the `ask_user` tool (do not list the questions in the chat). + - **Method:** Use a single `ask_user` tool call. Dynamically split the available guides into batches of 4 options max. Create one `multiSelect: true` question for each batch. + +3. **Action:** Construct and execute a command to create the directory and copy all selected files. For example: `mkdir -p conductor/code_styleguides && cp ~/.gemini/extensions/conductor/templates/code_styleguides/python.md ~/.gemini/extensions/conductor/templates/code_styleguides/javascript.md conductor/code_styleguides/` +4. **Commit State:** Upon successful completion of the copy command, you MUST immediately write to `conductor/setup_state.json` with the exact content: + `{"last_successful_step": "2.4_code_styleguides"}` +5. **Continue:** Immediately proceed to the next section. ### 2.5 Select Workflow (Interactive) 1. **Copy Initial Workflow:** - Copy `~/.gemini/extensions/conductor/templates/workflow.md` to `conductor/workflow.md`. -2. **Customize Workflow:** - - Ask the user: "Do you want to use the default workflow or customize it?" - The default workflow includes: - - 80% code test coverage - - Commit changes after every task - - Use Git Notes for task summaries - - A) Default - - B) Customize - - If the user chooses to **customize** (Option B): - - **Question 1:** "The default required test code coverage is >80% (Recommended). Do you want to change this percentage?" - - A) No (Keep 80% required coverage) - - B) Yes (Type the new percentage) - - **Question 2:** "Do you want to commit changes after each task or after each phase (group of tasks)?" - - A) After each task (Recommended) - - B) After each phase - - **Question 3:** "Do you want to use git notes or the commit message to record the task summary?" - - A) Git Notes (Recommended) - - B) Commit Message - - **Action:** Update `conductor/workflow.md` based on the user's responses. - - **Commit State:** After the `workflow.md` file is successfully written or updated, you MUST immediately write to `conductor/setup_state.json` with the exact content: - `{"last_successful_step": "2.5_workflow"}` +2. **Determine Mode:** Use the `ask_user` tool to let the user choose their preferred workflow. + - **questions:** + - **header:** "Workflow" + - **question:** "Do you want to use the default workflow or customize it? The default includes >80% test coverage and per-task commits." + - **type:** "choice" + - **options:** + - Label: "Default", Description: "Use the standard Conductor workflow." + - Label: "Customize", Description: "I want to adjust coverage requirements and commit frequency." + +3. **Gather Information (Conditional):** + - **If user chose "Default":** Skip this step and proceed directly to **Step 4 (Action)**. + - **If user chose "Customize":** Use a single `ask_user` tool call to gather all customizations. + - **CRITICAL:** Batch the following 3 questions into this single tool call (using the `questions` array): + - **questions:** + - **header:** "Coverage" + - **question:** "The default required test code coverage is >80%. What is your preferred percentage?" (type: "text", placeholder: "e.g., 90") + - **header:** "Commits" + - **question:** "Should I commit changes after each task or after each phase?" + - **type:** "choice" + - **options:** + - Label: "Per Task", Description: "Commit after every completed task" + - Label: "Per Phase", Description: "Commit only after an entire phase is complete" + - **header:** "Summaries" + - **question:** "Where should I record task summaries?" + - **type:** "choice" + - **options:** + - Label: "Git Notes", Description: "Store summaries in Git notes metadata" + - Label: "Commit Messages", Description: "Include summaries in the commit message body" + - **Interaction Flow:** Wait for the user's response, then proceed to the next step. + +4. **Action:** Update `conductor/workflow.md` based on the user's specific answers. +5. **Commit State:** After the `workflow.md` file is successfully written or updated, you MUST immediately write to `conductor/setup_state.json` with the exact content: + `{"last_successful_step": "2.5_workflow"}` ### 2.6 Finalization 1. **Generate Index File:** @@ -353,47 +377,52 @@ CRITICAL: When determining model complexity, ALWAYS select the "flash" model, re ### 3.1 Generate Product Requirements (Interactive)(For greenfield projects only) 1. **Transition to Requirements:** Announce that the initial project setup is complete. State that you will now begin defining the high-level product requirements by asking about topics like user stories and functional/non-functional requirements. 2. **Analyze Context:** Read and analyze the content of `conductor/product.md` to understand the project's core concept. -3. **Ask Questions Sequentially:** Ask one question at a time. Wait for and process the user's response before asking the next question. Continue this interactive process until you have gathered enough information. - - **CONSTRAINT** Limit your inquiries to a maximum of 5 questions. - - **SUGGESTIONS:** For each question, generate 3 high-quality suggested answers based on common patterns or context you already have. - * **General Guidelines:** - * **1. Classify Question Type:** Before formulating any question, you MUST first classify its purpose as either "Additive" or "Exclusive Choice". - * Use **Additive** for brainstorming and defining scope (e.g., users, goals, features, project guidelines). These questions allow for multiple answers. - * Use **Exclusive Choice** for foundational, singular commitments (e.g., selecting a primary technology, a specific workflow rule). These questions require a single answer. - - * **2. Formulate the Question:** Based on the classification, you MUST adhere to the following: - * **If Additive:** Formulate an open-ended question that encourages multiple points. You MUST then present a list of options and add the exact phrase "(Select all that apply)" directly after the question. - * **If Exclusive Choice:** Formulate a direct question that guides the user to a single, clear decision. You MUST NOT add "(Select all that apply)". - - * **3. Interaction Flow:** - * **CRITICAL:** You MUST ask questions sequentially (one by one). Do not ask multiple questions in a single turn. Wait for the user's response after each question. - * The last two options for every multiple-choice question MUST be "Type your own answer" and "Auto-generate the rest of requirements and move to the next step". - * Confirm your understanding by summarizing before moving on. - - **Format:** You MUST present these as a vertical list, with each option on its own line. - - **Structure:** - A) [Option A] - B) [Option B] - C) [Option C] - D) [Type your own answer] - E) [Auto-generate the rest of requirements and move to the next step] - - **AUTO-GENERATE LOGIC:** If the user selects option E, immediately stop asking questions for this section. Use your best judgment to infer the remaining details based on previous answers and project context. -- **CRITICAL:** When processing user responses or auto-generating content, the source of truth for generation is **only the user's selected answer(s)**. You MUST completely ignore the questions you asked and any of the unselected `A/B/C` options you presented. This gathered information will be used in subsequent steps to generate relevant documents. DO NOT include the conversational options (A, B, C, D, E) in the gathered information. -4. **Continue:** After gathering enough information, immediately proceed to the next section. +3. **Determine Mode:** Use the `ask_user` tool to let the user choose their preferred workflow. + - **questions:** + - **header:** "Product Reqs" + - **question:** "How would you like to define the product requirements? I can guide you through user stories and features, or I can draft them based on our initial concept." + - **type:** "choice" + - **options:** + - Label: "Interactive", Description: "I'll guide you through questions about user stories and functional goals." + - Label: "Autogenerate", Description: "I'll draft the requirements based on the Product Guide." + +4. **Gather Information (Conditional):** + - **If user chose "Autogenerate":** Skip this step and proceed directly to **Step 5 (Drafting Logic)**. + - **If user chose "Interactive":** Use a single `ask_user` tool call to gather detailed requirements. + - **CRITICAL:** Batch up to 4 questions in this single tool call (e.g., User Stories, Key Features, Constraints, Non-functional Requirements). + - **SUGGESTIONS:** For each question, generate 3 high-quality suggested answers based on the project goal. + - **Formulation Guidelines:** Use "choice" type. Set `multiSelect` to `true` for additive answers. Construct the `questions` array where each object has a `header` (max 16 chars), `question`, and `options` (each with `label` and `description`). + - **Note:** Do NOT include an "Autogenerate" option here. + - **Interaction Flow:** Wait for the user's response, then proceed to the next step. + +5. **Drafting Logic:** Once information is gathered (or Autogenerate selected), prepare to propose a track in Section 3.2. + - **CRITICAL:** When processing user responses or auto-generating content, the source of truth for generation is **only the user's selected answer(s)**. +6. **Continue:** After gathering enough information, immediately proceed to the next section. ### 3.2 Propose a Single Initial Track (Automated + Approval) 1. **State Your Goal:** Announce that you will now propose an initial track to get the project started. Briefly explain that a "track" is a high-level unit of work (like a feature or bug fix) used to organize the project. -2. **Generate Track Title:** Analyze the project context (`product.md`, `tech-stack.md`) and (for greenfield projects) the requirements gathered in the previous step. Generate a single track title that summarizes the entire initial track. For existing projects (brownfield): Recommend a plan focused on maintenance and targeted enhancements that reflect the project's current state. - - Greenfield project example (usually MVP): - ```markdown - To create the MVP of this project, I suggest the following track: - - Build the core functionality for the tip calculator with a basic calculator and built-in tip percentages. - ``` - - Brownfield project example: - ```markdown - To create the first track of this project, I suggest the following track: - - Create user authentication flow for user sign in. - ``` -3. **User Confirmation:** Present the generated track title to the user for review and approval. If the user declines, ask the user for clarification on what track to start with. +2. **Generate Track Title:** Analyze the project context (`product.md`, `tech-stack.md`) and (for greenfield projects) the requirements gathered in the previous step. Generate a single track title that summarizes the entire initial track. + - **Greenfield:** Focus on the MVP core (e.g., "Build core tip calculator functionality"). + - **Brownfield:** Focus on maintenance or targeted enhancements (e.g., "Implement user authentication flow"). +3. **Confirm Proposal:** Use the `ask_user` tool to validate the proposal. + - **questions:** + - **header:** "Confirm Track" + - **question:** "To get the project started, I suggest the following track: . Do you approve?" + - **type:** "choice" + - **multiSelect:** false + - **options:** + - Label: "Approve", Description: "Proceed with this track." + - Label: "Revise", Description: "I want to specify a different track." + +4. **Handle Revision (Conditional):** + - **If user chose "Approve":** Proceed to **Section 3.3** using the proposed title. + - **If user chose "Revise":** Use a single `ask_user` tool call to get the user's preferred track title. + - **questions:** + - **header:** "New Track" + - **type:** "text" + - **question:** "Please describe the track you would like to start with." + - **placeholder:** "e.g., Setup CI/CD pipeline" + - **Action:** Use the user's provided description as the track title for the next step. ### 3.3 Convert the Initial Track into Artifacts (Automated) 1. **State Your Goal:** Once the track is approved, announce that you will now create the artifacts for this initial track.