@cloudkinetix/bmad-enhanced
Version:
Cloud-Kinetix enhanced fork of BMAD-METHOD - Breakthrough Method of Agile AI-driven Development with robust versioning and unified validation.
242 lines (178 loc) • 6.66 kB
Markdown
# Task: Analyze Work Conflicts
> 🎯 **Claude Task Implementation** - Detect file conflicts between parallel work items using Claude's intelligence
## Description
Analyzes user-specified work items to identify potential file conflicts and group them into optimal execution waves. This prevents merge conflicts by ensuring agents working on the same files don't run simultaneously.
## Claude Task Implementation
This task uses Claude's analysis capabilities rather than bash scripts to predict file conflicts intelligently.
## Input
User command with work items:
```bash
/parallel-dev "Fix auth.js login bug" bg-login "Add dashboard charts" ft-dash "Style auth.js forms" ui-auth
```
## Analysis Process
### Step 1: Parse Work Items
Extract work items from user input:
- Work Item 1: "Fix auth.js login bug" → worktree: bg-login
- Work Item 2: "Add dashboard charts" → worktree: ft-dash
- Work Item 3: "Style auth.js forms" → worktree: ui-auth
### Step 2: Predict File Impact (Claude Intelligence)
For each work item, analyze the description to predict:
```
ANALYSIS TASK: File Impact Prediction
WORK DESCRIPTION: [User's exact description]
Analyze this work description and predict:
1. **Primary Files**: Which specific files will be modified?
2. **Test Files**: What test files will be created/updated?
3. **Related Components**: What system components are affected?
4. **Confidence Level**: How certain are these predictions?
Consider common patterns:
- "Fix [filename]" → likely modifies that specific file
- "Add [feature]" → likely creates new files + configuration
- "Style [component]" → likely modifies CSS/styling files
- "Update [module]" → likely modifies existing module files
Respond in this format:
FILES_TO_MODIFY:
- path/to/file1.js
- path/to/file2.css
- tests/file1.test.js
CONFIDENCE: High|Medium|Low
REASONING: [Brief explanation of prediction logic]
```
### Step 3: Build Conflict Matrix
Compare predicted file lists between work items:
```
Example Analysis:
bg-login: auth.js, login.component.js, auth.test.js (HIGH confidence)
ft-dash: dashboard.js, charts.component.js, dashboard.test.js (HIGH confidence)
ui-auth: auth.css, auth.js, login.component.js, auth.form.js (MEDIUM confidence)
Conflict Detection:
bg-login ↔ ui-auth: CONFLICT (auth.js, login.component.js)
bg-login ↔ ft-dash: NO CONFLICT
ft-dash ↔ ui-auth: NO CONFLICT
```
### Step 4: Generate Wave Plan
Group non-conflicting items into waves:
```
Wave Strategy:
Wave 1: ft-dash, bg-login (no shared files)
Wave 2: ui-auth (conflicts with bg-login)
Alternative (if user prefers different priority):
Wave 1: ft-dash, ui-auth (no shared files)
Wave 2: bg-login (conflicts with ui-auth)
```
## Implementation Notes
### Claude-Based Analysis
This task leverages Claude's natural language understanding to:
- Parse work descriptions intelligently
- Predict file modifications based on context
- Understand software development patterns
- Provide confidence assessments
### Conflict Detection Logic
```
Simple Overlap Detection:
for each work_item_1 in work_items:
for each work_item_2 in work_items:
if work_item_1 != work_item_2:
shared_files = intersection(files_1, files_2)
if shared_files:
conflicts.add((work_item_1, work_item_2, shared_files))
```
### Wave Planning Algorithm
```
Greedy Wave Assignment:
1. Start with all unassigned work items
2. Create new wave with first unassigned item
3. Add all non-conflicting items to same wave
4. Repeat until all items assigned
5. Optimize for maximum parallelism
```
## Output Format
### Analysis Report
```markdown
# Parallel Development Analysis
## Work Items
1. **bg-login**: Fix auth.js login bug
2. **ft-dash**: Add dashboard charts
3. **ui-auth**: Style auth.js forms
## File Impact Predictions
### bg-login (High Confidence)
- **Files**: auth.js, login.component.js, auth.test.js
- **Reasoning**: Fixing login bug directly targets auth system files
### ft-dash (High Confidence)
- **Files**: dashboard.js, charts.component.js, dashboard.test.js
- **Reasoning**: Adding charts creates new dashboard components
### ui-auth (Medium Confidence)
- **Files**: auth.css, auth.js, login.component.js, auth.form.js
- **Reasoning**: Styling auth forms touches CSS and form components
## Conflict Analysis
| Item 1 | Item 2 | Conflicts | Shared Files |
| -------- | ------- | --------- | --------------------------- |
| bg-login | ft-dash | ❌ None | - |
| bg-login | ui-auth | ⚠️ Yes | auth.js, login.component.js |
| ft-dash | ui-auth | ❌ None | - |
## Recommended Wave Plan
### Wave 1 (Parallel Execution)
- **ft-dash**: Add dashboard charts
- **bg-login**: Fix auth.js login bug
### Wave 2 (Sequential Execution)
- **ui-auth**: Style auth.js forms
## Execution Strategy
1. Deploy ft-dash + bg-login concurrently (no conflicts)
2. Wait for both to complete
3. Deploy ui-auth (builds on bg-login changes)
```
### JSON Output for System
```json
{
"analysis": {
"work_items": [
{
"id": "bg-login",
"description": "Fix auth.js login bug",
"predicted_files": ["auth.js", "login.component.js", "auth.test.js"],
"confidence": "high"
},
{
"id": "ft-dash",
"description": "Add dashboard charts",
"predicted_files": [
"dashboard.js",
"charts.component.js",
"dashboard.test.js"
],
"confidence": "high"
},
{
"id": "ui-auth",
"description": "Style auth.js forms",
"predicted_files": [
"auth.css",
"auth.js",
"login.component.js",
"auth.form.js"
],
"confidence": "medium"
}
],
"conflicts": [
{
"items": ["bg-login", "ui-auth"],
"shared_files": ["auth.js", "login.component.js"],
"severity": "medium"
}
],
"wave_plan": {
"wave_1": ["ft-dash", "bg-login"],
"wave_2": ["ui-auth"]
}
},
"execution_ready": true
}
```
## Benefits
1. **Intelligent Prediction**: Uses Claude's understanding of software development
2. **Context Awareness**: Analyzes work descriptions rather than just filenames
3. **Conflict Prevention**: Prevents merge conflicts before they occur
4. **Optimized Parallelism**: Maximizes concurrent work within safety constraints
5. **User Transparency**: Shows reasoning behind wave decisions
This Claude-native approach provides intelligent conflict detection while maintaining simplicity and reliability.