Skip to content

Commit eb9d127

Browse files
committed
fix(setup): refine project maturity detection and harden resume edge-cases
- Make Brownfield/Greenfield classification Conductor-aware. - Implement fast-forward logic to preserve maturity state during resumes. - Add self-healing cleanup step for interrupted track generations. - Streamline artifact definitions in the shallow audit table. - Require agent to explain maturity classification decisions.
1 parent 68a2a2c commit eb9d127

1 file changed

Lines changed: 32 additions & 17 deletions

File tree

commands/conductor/setup.toml

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,24 @@ CRITICAL: When determining model complexity, ALWAYS select the "flash" model, re
3131
- `tech-stack.md`
3232
- `code_styleguides/`
3333
- `workflow.md`
34-
- `tracks/`
34+
- `index.md`
35+
- `tracks/*/` (specifically `plan.md` and `index.md`)
3536
36-
2. **Determine Entry Point:** Map the project's state to the starting section using the following priority table (highest match wins):
37+
2. **Determine Target Section:** Map the project's state to a target section using the priority table below (highest match wins). **DO NOT JUMP YET.** Keep this target in mind.
3738
38-
| Artifact Exists | Resume At | Announcement |
39+
| Artifact Exists | Target Section | Announcement |
3940
| :--- | :--- | :--- |
40-
| `tracks/` | **HALT** | "The project is already initialized. Use `/conductor:newTrack` or `/conductor:implement`." |
41-
| `workflow.md` | **Section 3.0** | "Resuming setup: Scaffolding is complete. Next: generate the first track." |
41+
| All files in `tracks/<track_id>/` (`spec`, `plan`, `metadata`, `index`) | **HALT** | "The project is already initialized. Use `/conductor:newTrack` or `/conductor:implement`." |
42+
| `index.md` (top-level) | **Section 3.0** | "Resuming setup: Scaffolding is complete. Next: generate the first track. (Note: If an incomplete track folder was detected, we will restart this step to ensure a clean, consistent state)." |
43+
| `workflow.md` | **Section 2.6** | "Resuming setup: Workflow is defined. Next: generate project index." |
4244
| `code_styleguides/` | **Section 2.5** | "Resuming setup: Guides/Tech Stack configured. Next: define project workflow." |
4345
| `tech-stack.md` | **Section 2.4** | "Resuming setup: Tech Stack defined. Next: select Code Styleguides." |
4446
| `product-guidelines.md` | **Section 2.3** | "Resuming setup: Guidelines are complete. Next: define the Technology Stack." |
4547
| `product.md` | **Section 2.2** | "Resuming setup: Product Guide is complete. Next: create Product Guidelines." |
4648
| (None) | **Section 2.0** | (None) |
4749
50+
3. **Proceed to Section 2.0:** You MUST proceed to Section 2.0 to establish the Greenfield/Brownfield context before jumping to your target.
51+
4852
---
4953
5054
## 2.0 STREAMLINED PROJECT SETUP
@@ -55,17 +59,25 @@ CRITICAL: When determining model complexity, ALWAYS select the "flash" model, re
5559
1. **Detect Project Maturity:**
5660
- **Classify Project:** Determine if the project is "Brownfield" (Existing) or "Greenfield" (New) based on the following indicators:
5761
- **Brownfield Indicators:**
58-
- Check for existence of version control directories: `.git`, `.svn`, or `.hg`.
59-
- If a `.git` directory exists, execute `git status --porcelain`. If the output is not empty, classify as "Brownfield" (dirty repository).
60-
- Check for dependency manifests: `package.json`, `pom.xml`, `requirements.txt`, `go.mod`.
61-
- Check for source code directories: `src/`, `app/`, `lib/` containing code files.
62-
- If ANY of the above conditions are met (version control directory, dirty git repo, dependency manifest, or source code directories), classify as **Brownfield**.
62+
- Check for dependency manifests: `package.json`, `pom.xml`, `requirements.txt`, `go.mod`, `Cargo.toml`.
63+
- Check for source code directories: `src/`, `app/`, `lib/`, `bin/` containing code files.
64+
- If a `.git` directory exists, execute `git status --porcelain`. Ignore changes within the `conductor/` directory. If there are *other* uncommitted changes, it may be Brownfield.
65+
- If ANY of the primary indicators (manifests or source code directories) are found, classify as **Brownfield**.
6366
- **Greenfield Condition:**
64-
- Classify as **Greenfield** ONLY if NONE of the "Brownfield Indicators" are found AND the current directory is empty or contains only generic documentation (e.g., a single `README.md` file) without functional code or dependencies.
67+
- Classify as **Greenfield** ONLY if:
68+
1. NONE of the "Brownfield Indicators" are found.
69+
2. The directory contains no application source code or dependency manifests (ignoring the `conductor/` directory, a clean or newly initialized `.git` folder, and a `README.md`).
70+
6571
66-
2. **Execute Workflow based on Maturity:**
72+
2. **Resume Fast-Forward Check:**
73+
- If the **Target Section** (from 1.2) is anything other than "Section 2.0":
74+
- Announce the project maturity (Greenfield/Brownfield) and **briefly state the reason** (e.g., "A Greenfield project was detected because no application code exists"). Then announce the target section.
75+
- **IMMEDIATELY JUMP** to the Target Section. Do not execute the rest of Section 2.0.
76+
- If the Target Section is "Section 2.0", proceed to step 3.
77+
78+
3. **Execute Workflow based on Maturity:**
6779
- **If Brownfield:**
68-
- Announce that an existing project has been detected.
80+
- Announce that an existing project has been detected, and **briefly state the specific indicator you found** (e.g., "because I found a `package.json` file"). Be concise.
6981
- If the `git status --porcelain` command (executed as part of Brownfield Indicators) indicated uncommitted changes, inform the user: "WARNING: You have uncommitted changes in your Git repository. Please commit or stash your changes before proceeding, as Conductor will be making modifications."
7082
- **Begin Brownfield Project Initialization Protocol:**
7183
- **1.0 Pre-analysis Confirmation:**
@@ -99,13 +111,13 @@ CRITICAL: When determining model complexity, ALWAYS select the "flash" model, re
99111
4. **Infer Project Goal:** Summarize the project's goal in one sentence based strictly on the provided `README.md` header or `package.json` description.
100112
- **Upon completing the brownfield initialization protocol, proceed to the Generate Product Guide section in 2.1.**
101113
- **If Greenfield:**
102-
- Announce that a new project will be initialized.
114+
- Announce that new project will be initialized, briefly noting that no existing application code or dependencies were found.
103115
- Proceed to the next step in this file.
104116
105-
3. **Initialize Git Repository (for Greenfield):**
117+
4. **Initialize Git Repository (for Greenfield):**
106118
- If a `.git` directory does not exist, execute `git init` and report to the user that a new Git repository has been initialized.
107119
108-
4. **Inquire about Project Goal (for Greenfield):**
120+
5. **Inquire about Project Goal (for Greenfield):**
109121
- **Ask the user the following question using the `ask_user` tool and wait for their response before proceeding to the next step:**
110122
- **header:** "Project Goal"
111123
- **type:** "text"
@@ -116,7 +128,7 @@ CRITICAL: When determining model complexity, ALWAYS select the "flash" model, re
116128
- Execute `mkdir -p conductor`.
117129
- Write the user's response into `conductor/product.md` under a header named `# Initial Concept`.
118130
119-
5. **Continue:** Immediately proceed to the next section.
131+
6. **Continue:** Immediately proceed to the next section.
120132
121133
### 2.1 Generate Product Guide (Interactive)
122134
1. **Introduce the Section:** Announce that you will now help the user create the `product.md`.
@@ -390,6 +402,8 @@ CRITICAL: When determining model complexity, ALWAYS select the "flash" model, re
390402
## 3.0 INITIAL PLAN AND TRACK GENERATION
391403
**PROTOCOL: Interactively define project requirements, propose a single track, and then automatically create the corresponding track and its phased plan.**
392404
405+
**Pre-Requisite (Cleanup):** If you are resuming this section because a previous setup was interrupted, check if the `conductor/tracks/` directory exists but is incomplete. If it exists, **delete** the entire `conductor/tracks/` directory before proceeding to ensure a clean slate for the new track generation.
406+
393407
### 3.1 Generate Product Requirements (Interactive)(For greenfield projects only)
394408
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.
395409
2. **Analyze Context:** Read and analyze the content of `conductor/product.md` to understand the project's core concept.
@@ -476,6 +490,7 @@ CRITICAL: When determining model complexity, ALWAYS select the "flash" model, re
476490
- [Implementation Plan](./plan.md)
477491
- [Metadata](./metadata.json)
478492
```
493+
*(If you arrived here directly from the Audit because you are patching a missing index, write this file using the existing folder's track_id and then proceed to step d.)*
479494
480495
d. **Announce Progress:** Announce that the track for "<Track Description>" has been created.
481496

0 commit comments

Comments
 (0)