claude-fsd 1.5.8 → 1.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/claudefsd CHANGED
@@ -79,9 +79,7 @@ show_menu() {
79
79
  echo " 2) [Requires interview first]"
80
80
  fi
81
81
 
82
- echo " 3) Development - Choose development approach:"
83
- echo " 3a) Direct execution - Single-context parallel agents (small-medium projects)"
84
- echo " 3b) Iterative development - Multi-cycle planning loop (large projects)"
82
+ echo " 3) Development - Run automated development"
85
83
  echo " 4) Exit"
86
84
  echo
87
85
 
@@ -173,7 +171,7 @@ open_with_editor() {
173
171
  # Check dependencies first
174
172
  check_dependencies
175
173
 
176
- # Function to check for updates (non-blocking)
174
+ # Function to check for updates and auto-update if needed
177
175
  check_for_updates() {
178
176
  # Only check if we can reach npm registry quickly
179
177
  if timeout 2 npm view claude-fsd version >/dev/null 2>&1; then
@@ -182,8 +180,16 @@ check_for_updates() {
182
180
 
183
181
  if [ -n "$current_version" ] && [ -n "$latest_version" ] && [ "$current_version" != "$latest_version" ]; then
184
182
  echo -e "${YELLOW}📦 Update available: claude-fsd $current_version → $latest_version${NC}"
185
- echo -e "${YELLOW} Run: npm update -g claude-fsd${NC}"
186
- echo
183
+ echo -e "${GREEN}🔄 Auto-updating claude-fsd...${NC}"
184
+
185
+ # Attempt automatic update
186
+ if npm update -g claude-fsd >/dev/null 2>&1; then
187
+ echo -e "${GREEN}✅ Successfully updated to claude-fsd $latest_version${NC}"
188
+ echo
189
+ else
190
+ echo -e "${YELLOW}⚠️ Auto-update failed. Please run manually: npm update -g claude-fsd${NC}"
191
+ echo
192
+ fi
187
193
  fi
188
194
  fi
189
195
  }
@@ -254,23 +260,11 @@ if [ $# -eq 0 ]; then
254
260
  fi
255
261
  ;;
256
262
  3)
257
- # Auto-detect development mode
258
- echo -e "${GREEN}Auto-detecting development approach...${NC}"
263
+ # Run development mode
264
+ echo -e "${GREEN}Starting development mode...${NC}"
259
265
  echo
260
266
  exec "$(dirname "$0")/claudefsd-dev"
261
267
  ;;
262
- 3a)
263
- # Direct execution mode
264
- echo -e "${GREEN}Starting direct execution mode...${NC}"
265
- echo
266
- exec "$(dirname "$0")/claudefsd-dev" direct
267
- ;;
268
- 3b)
269
- # Iterative development mode
270
- echo -e "${GREEN}Starting iterative development mode...${NC}"
271
- echo
272
- exec "$(dirname "$0")/claudefsd-dev" iterative
273
- ;;
274
268
  4)
275
269
  echo "Goodbye!"
276
270
  exit 0
@@ -295,21 +289,6 @@ else
295
289
  shift
296
290
  exec "$(dirname "$0")/claudefsd-create-plan" "$@"
297
291
  ;;
298
- dev-direct)
299
- # Direct CLI access to direct mode
300
- shift
301
- exec "$(dirname "$0")/claudefsd-dev" direct "$@"
302
- ;;
303
- dev-iterative)
304
- # Direct CLI access to iterative mode
305
- shift
306
- exec "$(dirname "$0")/claudefsd-dev" iterative "$@"
307
- ;;
308
- dev-mini)
309
- # Legacy support - redirect to direct mode
310
- shift
311
- exec "$(dirname "$0")/claudefsd-dev" direct "$@"
312
- ;;
313
292
  *)
314
293
  echo -e "${RED}Unknown command: $1${NC}"
315
294
  echo
@@ -318,9 +297,7 @@ else
318
297
  echo "Commands:"
319
298
  echo " interview - Interactive requirements gathering"
320
299
  echo " create-plan - Create plan from requirements or questions"
321
- echo " dev|run - Run development mode (auto-detects approach)"
322
- echo " dev-direct - Force direct execution mode"
323
- echo " dev-iterative - Force iterative development mode"
300
+ echo " dev|run - Run automated development mode"
324
301
  echo
325
302
  echo "Run without arguments for interactive mode."
326
303
  exit 1
@@ -57,10 +57,12 @@ The CLAUDE-NOTES.md should contain:
57
57
  - Areas that may need future clarification
58
58
 
59
59
  The PLAN.md should contain:
60
- - Ordered list of development tasks with [ ] checkboxes
61
- - Each task should be specific and actionable
60
+ - Master plan limited to 100 lines maximum
61
+ - High-level sections with [ ] checkboxes for completion tracking
62
+ - For complex projects, reference detailed sub-plans in separate files (docs/plan-section1.md, docs/plan-section2.md, etc.)
62
63
  - Include proportional infrastructure setup (basic linting + pre-commit hooks)
63
64
  - Group related tasks into logical phases
65
+ - If the plan would exceed 100 lines, create a master plan with section references and detailed sub-plans
64
66
 
65
67
  INFRASTRUCTURE PROPORTIONALITY RULES:
66
68
  - Basic linter + pre-commit hooks: Always include for any project
@@ -112,8 +114,10 @@ Using your deep strategic reasoning, create a comprehensive project architecture
112
114
  - Long-term maintainability strategy
113
115
 
114
116
  2. IMPLEMENTATION PLAN (docs/PLAN.md):
117
+ - Master plan limited to 100 lines maximum with high-level sections
118
+ - For complex projects, create detailed sub-plans in separate files (docs/plan-section1.md, etc.)
115
119
  - Phased development approach with clear milestones
116
- - Detailed task breakdown with dependencies
120
+ - Task breakdown with dependencies (detailed in sub-plans if needed)
117
121
  - Risk assessment for each phase
118
122
  - Testing strategy integrated into each phase
119
123
  - Infrastructure needs (proportional to project size)
package/bin/claudefsd-dev CHANGED
@@ -1,63 +1,230 @@
1
1
  #!/bin/bash
2
2
  #
3
- # Main development dispatcher - routes to appropriate development mode
4
- # Usage: claudefsd-dev [direct|iterative]
5
- #
6
- # Modes:
7
- # direct: Single-context parallel execution (small to medium projects)
8
- # iterative: Multi-iteration loop development (large projects)
3
+ # Main development mode - intelligent task selection with parallel execution
4
+ # Usage: claudefsd-dev
5
+ #
6
+ # Features:
7
+ # - Fail-fast loop detection and "all done" prompt from iterative mode
8
+ # - Direct parallel Task agent execution from direct mode
9
+ # - Intelligent task planning and coordination
9
10
  #
10
- # Examples:
11
- # claudefsd-dev # Auto-detect mode from project brief
12
- # claudefsd-dev direct # Force direct execution mode
13
- # claudefsd-dev iterative # Force iterative loop mode
14
11
 
15
12
  set -e
16
13
 
17
- # Parse command line arguments or auto-detect mode
18
- DEV_MODE="$1"
19
- if [ -z "$DEV_MODE" ]; then
20
- # Auto-detect mode from BRIEF.md
21
- if [ -f "BRIEF.md" ] || [ -f "docs/BRIEF.md" ]; then
22
- BRIEF_FILE="BRIEF.md"
23
- [ -f "docs/BRIEF.md" ] && BRIEF_FILE="docs/BRIEF.md"
14
+ # Get the actual location of this script (resolving symlinks)
15
+ if command -v realpath >/dev/null 2>&1; then
16
+ SCRIPT_PATH="$(realpath "$0")"
17
+ elif command -v readlink >/dev/null 2>&1; then
18
+ # macOS doesn't have realpath by default, but has readlink
19
+ SCRIPT_PATH="$0"
20
+ while [ -L "$SCRIPT_PATH" ]; do
21
+ SCRIPT_PATH="$(readlink "$SCRIPT_PATH")"
22
+ done
23
+ SCRIPT_PATH="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)/$(basename "$SCRIPT_PATH")"
24
+ else
25
+ # Fallback if neither command is available
26
+ SCRIPT_PATH="$(cd "$(dirname "$0")" && pwd)/$(basename "$0")"
27
+ fi
28
+
29
+ # Get the directory containing the script
30
+ SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
31
+
32
+ # Check dependencies
33
+ "$SCRIPT_DIR/claudefsd-check-dependencies"
34
+
35
+ # Function to check for required files
36
+ check_requirements() {
37
+ # Load find_brief_file function
38
+ source "$SCRIPT_DIR/claudefsd-find-brief"
39
+ brief_file=$(find_brief_file 2>/dev/null || echo "")
40
+
41
+ if [ -z "$brief_file" ]; then
42
+ echo "No BRIEF.md file found in docs/ or root directory. Please create one first."
43
+ exit 1
44
+ fi
45
+
46
+ if [ ! -f "docs/PLAN.md" ]; then
47
+ echo "No docs/PLAN.md file found. Please run 'claudefsd create-plan' first."
48
+ exit 1
49
+ fi
50
+ }
51
+
52
+ # Check requirements
53
+ check_requirements
54
+
55
+ # Add counter for loop iterations
56
+ LOOP_COUNTER=0
57
+
58
+ # Failure detection variables
59
+ CONSECUTIVE_FAST_ITERATIONS=0
60
+ MIN_ITERATION_TIME=300 # 5 minutes in seconds
61
+
62
+ while true; do
63
+ # Record iteration start time
64
+ ITERATION_START_TIME=$(date +%s)
65
+
66
+ # Increment loop counter
67
+ LOOP_COUNTER=$((LOOP_COUNTER + 1))
68
+
69
+ mkdir -p logs
70
+ # Use a temporary directory for tmp files
71
+ mkdir -p tmp
72
+ export TMPDIR=tmp/
73
+ LOGFILE="logs/claude-dev-$(date +%Y%m%d_%H%M%S).txt"
74
+
75
+ echo "Logging to ${LOGFILE} ..."
76
+
77
+ echo -e "\033[32m==================================================================\033[0m"
78
+ echo -e "\033[32m== DEVELOPMENT MODE - ITERATION $LOOP_COUNTER\033[0m"
79
+ echo -e "\033[32m==================================================================\033[0m"
80
+
81
+ # Check if this is the 4th iteration for megathinking mode
82
+ if [ $((LOOP_COUNTER % 4)) -eq 0 ]; then
83
+ echo -e "\033[33m**** MEGATHINKING MODE ACTIVATED ****\033[0m"
84
+ echo -e "\033[33mThis is your 4th development cycle. Taking a step back for architectural planning.\033[0m"
85
+ MEGATHINKING_MODE="**** MEGATHINKING MODE ACTIVATED ****\nThis is your 4th development cycle. Before proceeding with the next task, please take a step back and use megathinking mode to architecturally plan the next phase of development. Consider the overall structure of the codebase, potential refactoring opportunities, design patterns, technical debt, and how the current work connects to broader project goals.\n\n"
86
+ CLAUDE_MODEL="opus"
87
+ else
88
+ MEGATHINKING_MODE=""
89
+ CLAUDE_MODEL="sonnet"
90
+ fi
91
+
92
+ # Build the development prompt combining intelligent task selection with parallel execution
93
+ DEVELOPMENT_PROMPT="$MEGATHINKING_MODE
94
+ You are an elite development team leader working in an automated development environment. You combine intelligent task selection with parallel execution capabilities for maximum efficiency.
95
+
96
+ **PROJECT CONTEXT:**
97
+ $(source "$SCRIPT_DIR/claudefsd-find-brief" && brief_file=$(find_brief_file 2>/dev/null) && [ -n "$brief_file" ] && echo "=== PROJECT BRIEF ===" && cat "$brief_file" && echo "")
98
+ $([ -f "docs/PLAN.md" ] && echo "=== DEVELOPMENT PLAN ===" && cat "docs/PLAN.md" && echo "")
99
+ $([ -f "docs/REQUIREMENTS.md" ] && echo "=== REQUIREMENTS ===" && cat "docs/REQUIREMENTS.md" && echo "")
100
+ $([ -f "docs/QUESTIONS.md" ] && echo "=== QUESTIONS ===" && cat "docs/QUESTIONS.md" && echo "")
101
+ $([ -f "docs/CLAUDE-NOTES.md" ] && echo "=== TECHNICAL NOTES ===" && cat "docs/CLAUDE-NOTES.md" && echo "")
102
+ $([ -f "README.md" ] && echo "=== README ===" && cat "README.md" && echo "")
103
+
104
+ **IMPORTANT:** Before starting ANY work, you MUST read and understand:
105
+ 1. The project's CLAUDE.md file (if it exists) - this contains project-specific instructions
106
+ 2. The user's global CLAUDE.md file at ~/.claude/CLAUDE.md (if it exists) - this contains general development principles
107
+ 3. Ensure all your work follows the architectural and development guidelines from both files
108
+
109
+ **CRITICAL ANTI-PATTERNS TO AVOID (from CLAUDE.md):**
110
+ - NO CHEATING: Never disable tests, exclude files from compilation, or use silent fallbacks
111
+ - FAIL FAST: Integration failures should throw exceptions, not return mock data
112
+ - NO PRODUCTION FALLBACKS: Avoid try/catch blocks that hide errors with default values
113
+ - NO BACKUP COPIES: Use git for version control, never create backup files
114
+ - DELETE OLD CODE: Remove unused functions and scripts, keep the codebase clean
115
+
116
+ **YOUR MISSION:**
117
+
118
+ **PHASE 1: INTELLIGENT TASK ANALYSIS**
119
+ 1. Read the current docs/PLAN.md and identify all open tasks that need completion
120
+ 2. Analyze task dependencies and determine what can be done in parallel
121
+ 3. Consider the architectural implications of each task
122
+ 4. Prioritize tasks based on:
123
+ - Order in the plan (primary factor)
124
+ - Dependencies between tasks
125
+ - Risk and efficiency considerations
126
+ - Overall project architecture
127
+
128
+ **PHASE 2: EXECUTION STRATEGY**
129
+ Choose the optimal approach:
130
+
131
+ **Option A: Single Focus Task** (for sequential dependencies or complex architectural work)
132
+ - Select the highest priority open task
133
+ - Implement with deep thinking and careful consideration
134
+ - Update docs/PLAN.md to mark task as complete
135
+
136
+ **Option B: Parallel Task Execution** (for independent tasks)
137
+ - Identify 2-4 related but independent tasks that can be done simultaneously
138
+ - Launch multiple Task agents with coordinated objectives
139
+ - Each agent should understand the full project context
140
+ - Ensure consistency across all parallel work
141
+
142
+ **PHASE 3: COMPLETION CHECK**
143
+ After completing work:
144
+ 1. Update docs/PLAN.md to reflect completed tasks
145
+ 2. Run any linters or tests specified in the project
146
+ 3. If ALL tasks in docs/PLAN.md are complete, respond with: **<ALL DONE>**
147
+
148
+ **EXECUTION GUIDELINES:**
149
+ - **BUILD BULLETPROOF**: Create robust solutions that handle edge cases
150
+ - **STAY FOCUSED**: Only implement what's specified in docs/PLAN.md
151
+ - **QUALITY FIRST**: Proper error handling, testing, and documentation
152
+ - **ARCHITECTURAL THINKING**: Consider long-term maintainability
153
+
154
+ **TASK AGENT COORDINATION:**
155
+ When using parallel Task agents, ensure each one:
156
+ - Has full project context and understands the architecture
157
+ - Knows about related components they might need to integrate with
158
+ - Follows all CLAUDE.md guidelines
159
+ - Implements consistent code style and patterns
160
+ - Handles proper error checking and edge cases
161
+
162
+ **OUTPUT FORMAT:**
163
+ 1. **<task_analysis>**: List identified open tasks and selected approach
164
+ 2. **<execution>**: Details of your implementation work
165
+ 3. **<plan_updates>**: How you updated docs/PLAN.md to reflect progress
166
+ 4. **<completion_check>**: Status of remaining work, or **<ALL DONE>** if complete
167
+
168
+ Begin by analyzing the current state of docs/PLAN.md and determining your execution strategy."
169
+
170
+ # Save the prompt to the log file first
171
+ echo "=== DEVELOPMENT PROMPT ===" > $LOGFILE
172
+ echo "$DEVELOPMENT_PROMPT" >> $LOGFILE
173
+ echo "=== END PROMPT ===" >> $LOGFILE
174
+ echo "" >> $LOGFILE
175
+ echo "=== OUTPUT ===" >> $LOGFILE
176
+
177
+ # Run claude and append output to the log file
178
+ echo "Running development with $CLAUDE_MODEL model..."
179
+ time claude --model $CLAUDE_MODEL --dangerously-skip-permissions -p "$DEVELOPMENT_PROMPT" 2>&1 | tee -a $LOGFILE
180
+
181
+ # Check if all tasks are complete
182
+ set +e
183
+ if grep -q "<ALL DONE>" $LOGFILE; then
184
+ echo -e "\033[32m==================================================================\033[0m"
185
+ echo -e "\033[32m== PROJECT COMPLETE - ALL TASKS FINISHED!\033[0m"
186
+ echo -e "\033[32m==================================================================\033[0m"
187
+ exit 0
188
+ fi
189
+ set -e
190
+
191
+ # Calculate iteration duration and check for failure patterns
192
+ ITERATION_END_TIME=$(date +%s)
193
+ ITERATION_DURATION=$((ITERATION_END_TIME - ITERATION_START_TIME))
194
+
195
+ echo -e "\033[36mIteration $LOOP_COUNTER completed in ${ITERATION_DURATION}s\033[0m"
196
+
197
+ # Check if iteration was suspiciously fast (likely failure mode)
198
+ if [ $ITERATION_DURATION -lt $MIN_ITERATION_TIME ]; then
199
+ CONSECUTIVE_FAST_ITERATIONS=$((CONSECUTIVE_FAST_ITERATIONS + 1))
200
+ echo -e "\033[33mWarning: Fast iteration detected (${ITERATION_DURATION}s < ${MIN_ITERATION_TIME}s threshold)\033[0m"
201
+ echo -e "\033[33mConsecutive fast iterations: $CONSECUTIVE_FAST_ITERATIONS/3\033[0m"
24
202
 
25
- # Look for indicators of small/medium vs large projects
26
- if grep -qi "simple\|small\|quick\|prototype\|poc\|minimal\|script\|tool\|utility\|feature\|module" "$BRIEF_FILE"; then
27
- DEV_MODE="direct"
28
- else
29
- DEV_MODE="iterative"
203
+ # Exit if too many consecutive fast iterations (likely Claude API failure)
204
+ if [ $CONSECUTIVE_FAST_ITERATIONS -ge 3 ]; then
205
+ echo -e "\033[31m==================================================================\033[0m"
206
+ echo -e "\033[31m== FAILURE MODE DETECTED - THROTTLING ACTIVATED\033[0m"
207
+ echo -e "\033[31m==================================================================\033[0m"
208
+ echo -e "\033[31mDetected 3 consecutive iterations under ${MIN_ITERATION_TIME}s each.\033[0m"
209
+ echo -e "\033[31mThis usually indicates Claude API issues (token limits, etc).\033[0m"
210
+ echo -e "\033[31m\033[0m"
211
+ echo -e "\033[31mSuggested actions:\033[0m"
212
+ echo -e "\033[31m- Check your Claude API token limits\033[0m"
213
+ echo -e "\033[31m- Wait a few minutes and restart with: claudefsd dev\033[0m"
214
+ echo -e "\033[31m- Review logs in: logs/\033[0m"
215
+ echo -e "\033[31m==================================================================\033[0m"
216
+ exit 1
30
217
  fi
218
+
219
+ # Add exponential backoff delay for fast iterations
220
+ BACKOFF_DELAY=$((CONSECUTIVE_FAST_ITERATIONS * 60)) # 1min, 2min, 3min
221
+ echo -e "\033[33mApplying backoff delay: ${BACKOFF_DELAY}s\033[0m"
222
+ sleep $BACKOFF_DELAY
31
223
  else
32
- DEV_MODE="iterative" # Default to iterative for safety
224
+ # Reset counter on successful iteration
225
+ CONSECUTIVE_FAST_ITERATIONS=0
226
+ echo -e "\033[32mNormal iteration timing - continuing...\033[0m"
33
227
  fi
34
- fi
35
228
 
36
- echo "Development mode: $DEV_MODE"
37
-
38
- # Route to appropriate development script
39
- case "$DEV_MODE" in
40
- direct)
41
- echo "Launching direct execution mode..."
42
- exec "$(dirname "$0")/claudefsd-dev-direct"
43
- ;;
44
- iterative)
45
- echo "Launching iterative development mode..."
46
- exec "$(dirname "$0")/claudefsd-dev-iterative"
47
- ;;
48
- small)
49
- # Legacy support - map to direct
50
- echo "Legacy 'small' mode - redirecting to direct execution..."
51
- exec "$(dirname "$0")/claudefsd-dev-direct"
52
- ;;
53
- large)
54
- # Legacy support - map to iterative
55
- echo "Legacy 'large' mode - redirecting to iterative development..."
56
- exec "$(dirname "$0")/claudefsd-dev-iterative"
57
- ;;
58
- *)
59
- echo "Unknown development mode: $DEV_MODE"
60
- echo "Valid modes: direct, iterative"
61
- exit 1
62
- ;;
63
- esac
229
+ sleep 1
230
+ done
package/package.json CHANGED
@@ -1,14 +1,12 @@
1
1
  {
2
2
  "name": "claude-fsd",
3
- "version": "1.5.8",
3
+ "version": "1.5.10",
4
4
  "description": "Claude Full Self Drive tools for autonomous AI-powered development",
5
5
  "bin": {
6
6
  "claude-fsd": "bin/claude-fsd",
7
7
  "claudefsd": "bin/claudefsd",
8
8
  "claudefsd-check-dependencies": "bin/claudefsd-check-dependencies",
9
9
  "claudefsd-dev": "bin/claudefsd-dev",
10
- "claudefsd-dev-direct": "bin/claudefsd-dev-direct",
11
- "claudefsd-dev-iterative": "bin/claudefsd-dev-iterative",
12
10
  "claudefsd-find-brief": "bin/claudefsd-find-brief",
13
11
  "claudefsd-interview": "bin/claudefsd-interview",
14
12
  "claudefsd-analyze-brief": "bin/claudefsd-analyze-brief",
@@ -1,181 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- # Get the actual location of this script (resolving symlinks)
6
- if command -v realpath >/dev/null 2>&1; then
7
- SCRIPT_PATH="$(realpath "$0")"
8
- elif command -v readlink >/dev/null 2>&1; then
9
- # macOS doesn't have realpath by default, but has readlink
10
- SCRIPT_PATH="$0"
11
- while [ -L "$SCRIPT_PATH" ]; do
12
- SCRIPT_PATH="$(readlink "$SCRIPT_PATH")"
13
- done
14
- SCRIPT_PATH="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)/$(basename "$SCRIPT_PATH")"
15
- else
16
- # Fallback if neither command is available
17
- SCRIPT_PATH="$(cd "$(dirname "$0")" && pwd)/$(basename "$0")"
18
- fi
19
-
20
- # Get the directory containing the script
21
- SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
22
-
23
- # Check dependencies
24
- "$SCRIPT_DIR/claudefsd-check-dependencies"
25
-
26
- # Use a temporary directory for tmp files
27
- tmp_dir="/tmp/claudefsd_tmp_$$"
28
- mkdir -p "$tmp_dir"
29
- cd "$tmp_dir"
30
-
31
- # Function to check for required files
32
- check_requirements() {
33
- # Load find_brief_file function
34
- source "$SCRIPT_DIR/claudefsd-find-brief"
35
- cd "$OLDPWD"
36
- brief_file=$(find_brief_file 2>/dev/null || echo "")
37
- cd "$tmp_dir"
38
-
39
-
40
- if [ -z "$brief_file" ]; then
41
- echo "No BRIEF.md file found in docs/ or root directory. Please create one first."
42
- exit 1
43
- fi
44
-
45
- if [ ! -f "$OLDPWD/docs/PLAN.md" ]; then
46
- echo "No docs/PLAN.md file found. Please run 'claudefsd create-plan' first."
47
- exit 1
48
- fi
49
- }
50
-
51
- # Check requirements
52
- check_requirements
53
-
54
- # Create logs directory
55
- mkdir -p "$OLDPWD/logs"
56
- LOGFILE="$OLDPWD/logs/claude-dev-direct-$(date +%Y%m%d_%H%M%S).txt"
57
-
58
- echo -e "\033[32m==================================================================\033[0m"
59
- echo -e "\033[32m== CLAUDE FSD DEV-DIRECT: PARALLEL EXECUTION MODE\033[0m"
60
- echo -e "\033[32m==================================================================\033[0m"
61
- echo
62
- echo "Direct execution mode uses parallel Task agents to complete projects"
63
- echo "in a single context. Optimized for small to medium-sized features."
64
- echo
65
-
66
- # Go back to the project directory
67
- cd "$OLDPWD"
68
-
69
- # Build the omnibus prompt
70
- set +e # Temporarily disable exit on error for prompt construction
71
- omnibus_prompt="You are an elite development team leader using Claude's Task agent capabilities for rapid parallel execution.
72
-
73
- **ANTI-GOLDPLATING DIRECTIVE**: This is direct execution mode optimized for small to medium projects. Focus on minimal viable solutions that meet requirements. Avoid over-engineering, unnecessary abstractions, or enterprise patterns unless explicitly required.
74
-
75
- PROJECT CONTEXT:
76
- $(cd "$OLDPWD" && source "$SCRIPT_DIR/claudefsd-find-brief" && brief_file=$(find_brief_file 2>/dev/null) && [ -n "$brief_file" ] && echo "=== PROJECT BRIEF ===" && cat "$brief_file" && echo "")
77
- $([ -f "$OLDPWD/docs/PLAN.md" ] && echo "=== DEVELOPMENT PLAN ===" && cat "$OLDPWD/docs/PLAN.md" && echo "")
78
- $([ -f "$OLDPWD/docs/REQUIREMENTS.md" ] && echo "=== REQUIREMENTS ===" && cat "$OLDPWD/docs/REQUIREMENTS.md" && echo "")
79
- $([ -f "$OLDPWD/docs/QUESTIONS.md" ] && echo "=== QUESTIONS ===" && cat "$OLDPWD/docs/QUESTIONS.md" && echo "")
80
- $([ -f "$OLDPWD/docs/CLAUDE-NOTES.md" ] && echo "=== TECHNICAL NOTES ===" && cat "$OLDPWD/docs/CLAUDE-NOTES.md" && echo "")
81
- $([ -f "$OLDPWD/README.md" ] && echo "=== README ===" && cat "$OLDPWD/README.md" && echo "")
82
-
83
- IMPORTANT: Before starting ANY work, you MUST read and understand:
84
- 1. The project's CLAUDE.md file (if it exists) - this contains project-specific instructions
85
- 2. The user's global CLAUDE.md file at ~/.claude/CLAUDE.md (if it exists) - this contains general development principles
86
- 3. Ensure all your work follows the architectural and development guidelines from both files
87
-
88
- CRITICAL ANTI-PATTERNS TO AVOID (from CLAUDE.md):
89
- - NO CHEATING: Never disable tests, exclude files from compilation, or use silent fallbacks
90
- - FAIL FAST: Integration failures should throw exceptions, not return mock data
91
- - NO PRODUCTION FALLBACKS: Avoid try/catch blocks that hide errors with default values
92
- - NO BACKUP COPIES: Use git for version control, never create backup files
93
- - DELETE OLD CODE: Remove unused functions and scripts, keep the codebase clean
94
-
95
- DIRECT MODE CONSTRAINTS:
96
- - MINIMAL SOLUTIONS: Keep implementations simple and focused
97
- - NO GOLDPLATING: Don't add features not explicitly requested
98
- - SINGLE ENTRY POINTS: Prefer single scripts over complex architectures
99
- - AVOID OVER-ENGINEERING: No custom exceptions, elaborate hierarchies, or abstractions unless required
100
- - SPEED OVER ENTERPRISE: Get it working correctly first, optimize for enterprise patterns only if needed
101
-
102
- YOUR MISSION:
103
- 1. Analyze the full project plan and identify all tasks that need to be completed
104
- 2. Group related tasks that can be done in parallel by different agents
105
- 3. Launch multiple Task agents concurrently to maximize efficiency
106
- 4. Each agent should have a clear, specific brief about what to implement
107
- 5. Coordinate the work to ensure consistency across all agents
108
-
109
- EXECUTION STRATEGY:
110
- - Read all project documentation first to understand the full scope
111
- - Create a mental map of dependencies between tasks
112
- - Launch agents for independent tasks in parallel batches
113
- - For dependent tasks, sequence them appropriately
114
- - Each agent should be given enough context to work autonomously
115
-
116
- TASK AGENT GUIDELINES FOR BRIEFS:
117
- When creating prompts for Task agents, ensure each one:
118
- - Has a clear, specific goal
119
- - Understands the project architecture and conventions
120
- - Knows about related components they might need to integrate with
121
- - Follows all CLAUDE.md guidelines
122
- - Includes relevant code style and testing requirements
123
-
124
- VERIFICATION:
125
- After all agents complete:
126
- - Review what was accomplished vs the plan
127
- - Run any tests or linters specified in the project
128
- - Summarize completion status and any issues encountered
129
-
130
- Start by analyzing the project and planning your parallel execution strategy.
131
- Then launch the Task agents to build this project rapidly and efficiently.
132
-
133
- Remember: This is a one-shot execution. Make it count!"
134
-
135
- set -e # Re-enable exit on error
136
-
137
- echo "Running Claude dev-mini omnibus prompt..."
138
- echo "This will launch multiple parallel Task agents to complete the project..."
139
- echo
140
-
141
- # Run the omnibus prompt
142
- claude --dangerously-skip-permissions -p "$omnibus_prompt" 2>&1 | tee "$LOGFILE"
143
-
144
- echo
145
- echo -e "\033[32m==================================================================\033[0m"
146
- echo -e "\033[32m== DEV-MINI EXECUTION COMPLETE\033[0m"
147
- echo -e "\033[32m==================================================================\033[0m"
148
- echo
149
-
150
- # Run a verifier to check progress
151
- verifier_prompt="You are a project completion verifier.
152
-
153
- Review the work that was just completed and compare it against:
154
- $([ -f docs/PLAN.md ] && echo "=== ORIGINAL PLAN ===" && cat docs/PLAN.md && echo "")
155
-
156
- Your job:
157
- 1. List what was successfully completed
158
- 2. List what remains to be done (if anything)
159
- 3. Estimate the completion percentage
160
- 4. Identify any issues or errors encountered
161
- 5. Recommend next steps:
162
- - If mostly complete: suggest minor fixes
163
- - If significantly incomplete: recommend switching to 'claudefsd dev' mode
164
-
165
- Be honest and thorough in your assessment.
166
- Format your response clearly with sections for completed tasks, remaining tasks, and recommendations."
167
-
168
- echo "Running completion verifier..."
169
- echo
170
-
171
- claude --dangerously-skip-permissions -p "$verifier_prompt" 2>&1 | tee -a "$LOGFILE"
172
-
173
- echo
174
- echo "Full log saved to: $LOGFILE"
175
- echo
176
- echo "If the project is incomplete, you can continue with:"
177
- echo " claudefsd dev # For iterative development mode"
178
- echo
179
-
180
- # Clean up
181
- rm -rf "$tmp_dir"
@@ -1,433 +0,0 @@
1
- #!/bin/bash
2
- #
3
- # Usage: claudefsd-dev [scale]
4
- #
5
- # scale: "small" for simple projects (≤$2K scale, minimal solutions)
6
- # "large" for complex projects ($1M+ scale, comprehensive solutions)
7
- # If not specified, auto-detects from BRIEF.md content or defaults to "large"
8
- #
9
- # Examples:
10
- # claudefsd-dev small # Force small-scale development mode
11
- # claudefsd-dev large # Force large-scale development mode
12
- # claudefsd-dev # Auto-detect scale from project brief
13
-
14
- set -e
15
-
16
- # Iterative mode is designed for large/complex projects
17
- PROJECT_SCALE="large"
18
- echo "Running iterative development mode (optimized for large/complex projects)"
19
-
20
- # Check dependencies
21
- $(dirname "$0")/claudefsd-check-dependencies
22
-
23
- # Add counter for loop iterations
24
- LOOP_COUNTER=0
25
-
26
- # Failure detection variables
27
- CONSECUTIVE_FAST_ITERATIONS=0
28
- MIN_ITERATION_TIME=300 # 5 minutes in seconds
29
-
30
- while true; do
31
- # Record iteration start time
32
- ITERATION_START_TIME=$(date +%s)
33
-
34
- # Increment loop counter
35
- LOOP_COUNTER=$((LOOP_COUNTER + 1))
36
-
37
- mkdir -p logs
38
- # Use a temporary directory for tmp files, as codex is sandboxed to this directory
39
- mkdir -p tmp
40
- export TMPDIR=tmp/
41
- LOGFILE="logs/claude-$(date +%Y%m%d_%H%M%S).txt"
42
-
43
- echo "Logging to ${LOGFILE}-* ..."
44
-
45
- echo -e "\033[32m==================================================================\033[0m"
46
- echo -e "\033[32m== PLANNING NEXT TASK\033[0m"
47
- echo -e "\033[32m==================================================================\033[0m"
48
-
49
- # Check if this is the 4th iteration for megathinking mode
50
- if [ $((LOOP_COUNTER % 4)) -eq 0 ]; then
51
- echo -e "\033[33m**** MEGATHINKING MODE ACTIVATED ****\033[0m"
52
- echo -e "\033[33mThis is your 4th development cycle. Taking a step back for architectural planning.\033[0m"
53
- MEGATHINKING_MODE="**** MEGATHINKING MODE ACTIVATED ****\nThis is your 4th development cycle. Before proceeding with the next task, please take a step back and use megathinking mode to architecturally plan the next phase of development. Consider the overall structure of the codebase, potential refactoring opportunities, design patterns, technical debt, and how the current work connects to broader project goals.\n\n"
54
- CLAUDE_MODEL="opus"
55
- else
56
- MEGATHINKING_MODE=""
57
- CLAUDE_MODEL="sonnet"
58
- fi
59
-
60
- # Define the planner prompt
61
- PLANNER_PROMPT="
62
- $MEGATHINKING_MODE
63
- You are an AI assistant specialized in project management and software development workflows. Your task is to analyze project documentation and identify the next open task for a developer to work on.
64
-
65
- Please follow these steps to complete your task:
66
-
67
- 1. Read the contents of docs/PLAN.md in order.
68
- 2. Identify all open tasks that need to be done by the developer.
69
- 3. Gather related context from docs/PLAN.md, docs/BRIEF.md (or BRIEF.md), docs/QUESTIONS.md, and docs/CLAUDE-NOTES.md.
70
- 4. Consider the bigger picture of the project and potential impacts of each task.
71
- 5. Evaluate the risk and efficiency of potential changes for each task.
72
- 6. Prioritize the tasks based primarily on their order in the plan, but also factor in importance, risk, and efficiency.
73
- 7. Select the most appropriate next task and formulate a response that includes the task description and relevant context.
74
-
75
- In your analysis, please consider the following:
76
- - Include any sub-bullet points or section information related to the tasks.
77
- - Think about how each task fits into the overall project goals.
78
- - Be aware of potential bottlenecks or situations where a single fix might resolve multiple issues.
79
- - Consider dependencies between tasks and how they might affect prioritization.
80
-
81
- Before providing your final task description, wrap your analysis inside <analysis> tags in your thinking block. This should include:
82
- - A list of all open tasks identified from docs/PLAN.md
83
- - An evaluation of each task's priority, risk, and efficiency
84
- - Consideration of task dependencies
85
- - Your reasoning for the final task selection, including how it fits into the project's broader context
86
-
87
- Your final output should be a clear, concise description of the next task, including relevant context and considerations. Use <task_description> tags for this output.
88
-
89
- If the plan is complete and there are no more tasks to be done, simply respond with <ALL DONE>.
90
-
91
- Example output structure:
92
-
93
- <analysis>
94
- [Your detailed analysis of the project documentation, list of open tasks, evaluation of each task, consideration of risks and impacts, and reasoning for task selection]
95
- </analysis>
96
-
97
- <task_description>
98
- [A concise description of the next task, including relevant context and considerations]
99
- </task_description>
100
-
101
- Please proceed with your analysis and task identification based on the project documentation. Your final output should consist only of the task description in <task_description> tags or <ALL DONE>, and should not duplicate or rehash any of the work you did in the analysis section.
102
-
103
- "
104
-
105
- # Save the prompt to the log file first
106
- echo "=== PROMPT ===" > $LOGFILE-planner
107
- echo "$PLANNER_PROMPT" >> $LOGFILE-planner
108
- echo "=== END PROMPT ===" >> $LOGFILE-planner
109
- echo "" >> $LOGFILE-planner
110
- echo "=== OUTPUT ===" >> $LOGFILE-planner
111
-
112
- # Run claude and append output to the log file
113
- time claude --model $CLAUDE_MODEL --dangerously-skip-permissions -p "$PLANNER_PROMPT" 2>&1 | tee -a $LOGFILE-planner
114
-
115
- nexttask=$(cat $LOGFILE-planner)
116
-
117
- echo -e "\033[32m==================================================================\033[0m"
118
- echo -e "\033[32m== RUNNING DEVELOPER TASK\033[0m"
119
- echo -e "\033[32m==================================================================\033[0m"
120
-
121
- # Show megathinking banner for developer if active
122
- if [ $((LOOP_COUNTER % 4)) -eq 0 ]; then
123
- echo -e "\033[33m**** MEGATHINKING MODE ACTIVATED ****\033[0m"
124
- echo -e "\033[33mThis is your 4th development cycle. Taking a step back for architectural planning.\033[0m"
125
- fi
126
-
127
- # Define thinking directive for iterative large-scale development
128
- THINKING_DIRECTIVE="**ARCHITECTURAL THINKING DIRECTIVE**: Before beginning, engage in deep thinking about the task implications, architectural considerations, and optimal approach. This is iterative development for a large-scale project that demands thoroughness and quality."
129
-
130
- # Mild anti-goldplating constraints - build bulletproof systems but stay focused
131
- SCALE_CONSTRAINTS="
132
- **ITERATIVE MODE GUIDELINES**:
133
- - BUILD BULLETPROOF: Create robust, well-architected solutions that handle edge cases
134
- - STAY FOCUSED: Don't add DevOps/CI/CD/infrastructure/monitoring unless it's explicitly in the plan
135
- - PLAN-DRIVEN: Only implement what's specified in docs/PLAN.md - no extra features
136
- - QUALITY FIRST: Proper error handling, testing, and documentation as specified
137
- - ARCHITECTURAL THINKING: Consider long-term maintainability and system design"
138
-
139
- # Define the developer prompt
140
- DEVELOPER_PROMPT="
141
- $MEGATHINKING_MODE
142
- $THINKING_DIRECTIVE
143
-
144
- You are an AI developer working within an automated development environment. Your role is to complete tasks, plan implementations, and maintain high-quality code. Here is the specific task you need to complete:
145
-
146
- <next_task>
147
- $nexttask
148
- </next_task>
149
-
150
- IMPORTANT: Before starting the task, you MUST read and understand:
151
- 1. The project's CLAUDE.md file (if it exists) - this contains project-specific instructions
152
- 2. The user's global CLAUDE.md file at ~/.claude/CLAUDE.md (if it exists) - this contains general development principles
153
- 3. Ensure all your work follows the architectural and development guidelines from both files
154
-
155
- Please follow these steps to complete the task:
156
-
157
- 1. **DEEP TASK ANALYSIS**: Analyze the task and plan your approach. In your thinking block, create an implementation plan wrapped in <implementation_plan> tags. Include:
158
- - A detailed breakdown of the task into clear, actionable steps
159
- - Whether this task would benefit from parallel agent decomposition
160
- - For each step, identify:
161
- * Potential challenges and proposed solutions
162
- * Architectural implications
163
- * How to adhere to clean code principles
164
- * Impact on the overall system
165
- * Defensive programming techniques to employ
166
- * Potential edge cases and how to handle them
167
- * A minimal, focused testing strategy (avoid extensive test infrastructure)
168
-
169
- 2. **EXECUTION STRATEGY**: Choose between:
170
- - **Single Agent Deep Work**: For focused sequential tasks requiring deep thinking
171
- - **Parallel Agent Coordination**: For multi-faceted tasks that can be decomposed
172
-
173
- If choosing parallel agents, use the Task tool to spawn focused sub-agents:
174
- - Core implementation agent
175
- - Test coverage agent
176
- - Error handling agent
177
- - Documentation agent
178
-
179
- 3. Execute the necessary changes or Bash commands to complete the task. Use parallel agents for dev work when appropriate to increase efficiency.
180
-
181
- 4. If a linter is defined for this project, run it and include the output in <linter_output> tags.
182
-
183
- 5. Describe the changes you've made in <changes> tags. Include:
184
- - A summary of implemented changes
185
- - Explanation of architectural decisions
186
- - Potential areas of concern or future considerations
187
- - Confirmation of defensive programming techniques
188
- - Verification that all failure modes throw exceptions
189
- - How edge cases were addressed
190
- - Outline of the testing strategy
191
-
192
- 6. Add any questions for future reference to the QUESTIONS.md file. Summarize these additions in <questions_update> tags.
193
-
194
- 7. Add any ideas for future improvements or features to the IDEAS.md file. Summarize these additions in <ideas_update> tags.
195
-
196
- Important guidelines:
197
- $SCALE_CONSTRAINTS
198
-
199
- - Simplicity: Delete old code, avoid hoarding. Use git for version control.
200
- - Brutal honesty: Disagree when needed. If something fails, let it fail visibly.
201
- - No cheating: Fix failing tests, don't skip them. No mocks without permission.
202
- - No production fallbacks: Never catch exceptions to return fallback values or silently handle integration failures.
203
- - Write real integration tests and run linters/tests frequently during development.
204
- - Stay on the current git branch if it's a feature branch.
205
- - Set up pre-commit hooks for basic SDLC protections.
206
-
207
- Your final output should follow this structure:
208
-
209
- <execution>
210
- [Details of executed changes or commands]
211
- </execution>
212
-
213
- <linter_output>
214
- [Linter output, if applicable]
215
- </linter_output>
216
-
217
- <changes>
218
- [Description of changes as outlined above]
219
- </changes>
220
-
221
- <questions_update>
222
- [Summary of questions added to QUESTIONS.md]
223
- </questions_update>
224
-
225
- <ideas_update>
226
- [Summary of ideas added to IDEAS.md]
227
- </ideas_update>
228
-
229
- Remember to adhere to the project's standards and best practices. Your work will be reviewed before being committed to the repository.
230
-
231
- Your final output should consist only of the execution details, linter output, changes description, questions update, and ideas update. Do not duplicate or rehash any of the work you did in the implementation planning section.
232
- "
233
-
234
- # Save the prompt to the log file first
235
- echo "=== PROMPT ===" > $LOGFILE-developer
236
- echo "$DEVELOPER_PROMPT" >> $LOGFILE-developer
237
- echo "=== END PROMPT ===" >> $LOGFILE-developer
238
- echo "" >> $LOGFILE-developer
239
- echo "=== OUTPUT ===" >> $LOGFILE-developer
240
-
241
- # Run claude and append output to the log file
242
- time claude --model $CLAUDE_MODEL --dangerously-skip-permissions -p "$DEVELOPER_PROMPT" | tee -a $LOGFILE-developer
243
-
244
- echo -e "\033[32m==================================================================\033[0m"
245
- echo -e "\033[32m== REVIEWING WORK (backgrounded)\033[0m"
246
- echo -e "\033[32m==================================================================\033[0m"
247
-
248
- # run the static code reviewer (codex can't do the git push part yet, so we need to follow up with claude after)
249
- # also run it in the background because it's very slow
250
- # Only run if codex is available
251
- if command -v codex >/dev/null 2>&1; then
252
- (codex --full-auto -m o3 -q "
253
- You are the team's static code reviewer.
254
- A developer has completed this task: $nexttask
255
- The developer's notes are at $LOGFILE-developer .
256
-
257
- Related docs:
258
- - docs/BRIEF.md (or BRIEF.md)
259
- - docs/PLAN.md
260
- - docs/QUESTIONS.md
261
- - docs/CLAUDE-NOTES.md
262
- - README.md
263
-
264
- Please review the task and make sure it's complete, and done to satisfaction.
265
- DO NOT trust the developer's notes, always review the code and build/test results yourself.
266
- Look for typical 'cheating' patterns:
267
- - Turning off unit tests or marking them as ignored
268
- - Taking files out of the compilation configuration
269
- - Redefining the plan to skip tasks that aren't working
270
- - Silent exception handlers that return fallback values instead of failing
271
- - Try/catch blocks that log warnings but continue with empty/default data
272
- - Any code that catches integration failures and returns mock responses
273
-
274
- Also note: please avoid switching git branches - stay on the current branch, as
275
- long as it's a proper feature branch.
276
-
277
- If the task is complete, or there are a lot of pending changes, do a git commit.
278
-
279
- If the task is not complete, adjust the item in docs/PLAN.md with suggestions for
280
- the developer to complete the task properly.
281
-
282
- If you have any questions of the user for the future, you can add them to QUESTIONS.md.
283
- If you have any ideas for the future, you can add them to IDEAS.md.
284
- " > $LOGFILE-reviewer) &
285
- else
286
- echo "Warning: codex not found, skipping background code review"
287
- echo "Codex not available, skipping static code review" > $LOGFILE-reviewer
288
- fi
289
-
290
- echo -e "\033[32m==================================================================\033[0m"
291
- echo -e "\033[32m== REVIEWING/TESTING/COMMITTING WORK\033[0m"
292
- echo -e "\033[32m==================================================================\033[0m"
293
-
294
- # Define the reviewer/tester prompt
295
- REVIEWER_PROMPT="
296
- You are an expert megathinker static code reviewer tasked with thoroughly examining a developer's work on a specific task. Your goal is to ensure the task is complete and meets high-quality standards.
297
-
298
- Here is the task the developer has completed:
299
-
300
- <task_description>
301
- ${nexttask}
302
- </task_description>
303
-
304
- IMPORTANT: Before starting your review, you MUST read and understand:
305
- 1. The project's CLAUDE.md file (if it exists) - this contains project-specific instructions
306
- 2. The user's global CLAUDE.md file at ~/.claude/CLAUDE.md (if it exists) - this contains general development principles
307
- 3. Verify that all recent changes comply with the architectural and development guidelines from both files
308
-
309
- To conduct your review, you have access to the following related documents:
310
- - docs/BRIEF.md (or BRIEF.md)
311
- - docs/PLAN.md
312
- - docs/QUESTIONS.md
313
- - docs/CLAUDE-NOTES.md
314
- - README.md
315
-
316
- The developer's notes are available in a file named ${LOGFILE}-developer.
317
-
318
- Instructions for your review process:
319
-
320
- 1. Carefully read and understand the task description.
321
- 2. Review the developer's notes, but do not trust them implicitly; verify them where possible.
322
- 3. Examine the code and build/test results independently.
323
- 4. Verify compliance with CLAUDE.md guidelines (both project and user files), paying special attention to:
324
- - Simplicity and clean code principles
325
- - No cheating patterns or production fallbacks
326
- - Proper error handling (fail fast, no silent failures)
327
- - Following architectural conventions
328
- 5. Look for common cheating or misunderstanding patterns, including but not limited to:
329
- - Disabling or ignoring unit tests
330
- - Excluding files from compilation
331
- - Redefining the plan to skip challenging tasks
332
- - Using silent exception handlers that return fallback values
333
- - Implementing try/catch blocks that log warnings but continue with empty/default data
334
- - Catching integration failures and returning mock responses
335
- - Build behaves differently for verifier than developer; this may come from them each running different scripts for compiling and running tests
336
- - Committing with --no-verify to turn off the pre-commit checks; the checks may need to change to be more flexible, upon careful thinking, but they shouldn't just be turned off
337
- 6. Stay on the current git branch, as long as it's a proper feature branch.
338
- 7. If the task is incomplete or unsatisfactory, update docs/PLAN.md with detailed suggestions for the developer to complete the task properly.
339
- 8. If you have questions for future consideration, add them to docs/QUESTIONS.md.
340
- 9. If you have ideas for future improvements, add them to docs/IDEAS.md.
341
-
342
- Before providing your final review, please break down your review process and show your thought process inside <code_review_process> tags in your thinking block:
343
-
344
- 1. Summarize the task description in your own words.
345
- 2. List out the key documents you need to review.
346
- 3. For each document, note down relevant quotes or information that pertain to the task.
347
- 4. Check CLAUDE.md compliance - list specific guidelines that apply to this task and verify adherence.
348
- 5. Explicitly look for any 'cheating' patterns and list any that you find.
349
- 6. Consider arguments for and against the task being complete and of satisfactory quality.
350
-
351
- This will ensure a thorough and careful examination of the developer's work. It's OK for this section to be quite long.
352
-
353
- After your analysis, provide a summary of your findings and any necessary actions in the following format:
354
-
355
- <review_summary>
356
- Task Status: [Complete/Incomplete]
357
- Quality Assessment: [Satisfactory/Unsatisfactory]
358
-
359
- Key Findings:
360
- 1. [Finding 1]
361
- 2. [Finding 2]
362
- ...
363
-
364
- Actions Taken:
365
- - [Action 1, e.g., 'Updated PLAN.md with suggestions for improvement']
366
- - [Action 2, e.g., 'Added question to QUESTIONS.md']
367
- ...
368
-
369
- </review_summary>
370
-
371
- Please proceed with your thorough code review and analysis. Your final output should consist only of the review summary and should not duplicate or rehash any of the work you did in the thinking block.
372
- "
373
-
374
- # Save the prompt to the log file first
375
- echo "=== PROMPT ===" > $LOGFILE-tester
376
- echo "$REVIEWER_PROMPT" >> $LOGFILE-tester
377
- echo "=== END PROMPT ===" >> $LOGFILE-tester
378
- echo "" >> $LOGFILE-tester
379
- echo "=== OUTPUT ===" >> $LOGFILE-tester
380
-
381
- # Run claude and append output to the log file
382
- time claude --model $CLAUDE_MODEL --dangerously-skip-permissions -p "$REVIEWER_PROMPT" | tee -a $LOGFILE-tester
383
-
384
- # Check if verifier has confirmed all tasks are truly complete
385
- set +e
386
- if grep -q "<VERIFIED_ALL_DONE>" $LOGFILE-tester; then
387
- echo -e "\033[32mAll tasks verified complete by reviewer - project finished!\033[0m"
388
- exit 0
389
- fi
390
- set -e
391
-
392
- # Calculate iteration duration and check for failure patterns
393
- ITERATION_END_TIME=$(date +%s)
394
- ITERATION_DURATION=$((ITERATION_END_TIME - ITERATION_START_TIME))
395
-
396
- echo -e "\033[36mIteration $LOOP_COUNTER completed in ${ITERATION_DURATION}s\033[0m"
397
-
398
- # Check if iteration was suspiciously fast (likely failure mode)
399
- if [ $ITERATION_DURATION -lt $MIN_ITERATION_TIME ]; then
400
- CONSECUTIVE_FAST_ITERATIONS=$((CONSECUTIVE_FAST_ITERATIONS + 1))
401
- echo -e "\033[33mWarning: Fast iteration detected (${ITERATION_DURATION}s < ${MIN_ITERATION_TIME}s threshold)\033[0m"
402
- echo -e "\033[33mConsecutive fast iterations: $CONSECUTIVE_FAST_ITERATIONS/3\033[0m"
403
-
404
- # Exit if too many consecutive fast iterations (likely Claude API failure)
405
- if [ $CONSECUTIVE_FAST_ITERATIONS -ge 3 ]; then
406
- echo -e "\033[31m==================================================================\033[0m"
407
- echo -e "\033[31m== FAILURE MODE DETECTED - THROTTLING ACTIVATED\033[0m"
408
- echo -e "\033[31m==================================================================\033[0m"
409
- echo -e "\033[31mDetected 3 consecutive iterations under ${MIN_ITERATION_TIME}s each.\033[0m"
410
- echo -e "\033[31mThis usually indicates Claude API issues (token limits, etc).\033[0m"
411
- echo -e "\033[31m\033[0m"
412
- echo -e "\033[31mSuggested actions:\033[0m"
413
- echo -e "\033[31m- Check your Claude API token limits\033[0m"
414
- echo -e "\033[31m- Wait a few minutes and restart with: claude-fsd dev\033[0m"
415
- echo -e "\033[31m- Review logs in: logs/\033[0m"
416
- echo -e "\033[31m==================================================================\033[0m"
417
- exit 1
418
- fi
419
-
420
- # Add exponential backoff delay for fast iterations
421
- BACKOFF_DELAY=$((CONSECUTIVE_FAST_ITERATIONS * 60)) # 1min, 2min, 3min
422
- echo -e "\033[33mApplying backoff delay: ${BACKOFF_DELAY}s\033[0m"
423
- sleep $BACKOFF_DELAY
424
- else
425
- # Reset counter on successful iteration
426
- CONSECUTIVE_FAST_ITERATIONS=0
427
- echo -e "\033[32mNormal iteration timing - continuing...\033[0m"
428
- fi
429
-
430
- sleep 1
431
- done
432
-
433
-
@@ -1,148 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- # Check dependencies
6
- $(dirname "$0")/claudefsd-check-dependencies
7
-
8
- # Use a temporary directory for tmp files
9
- tmp_dir="/tmp/claudefsd_tmp_$$"
10
- mkdir -p "$tmp_dir"
11
- cd "$tmp_dir"
12
-
13
- # Function to check for required files
14
- check_requirements() {
15
- # Load find_brief_file function
16
- source "$(dirname "$0")/claudefsd-find-brief"
17
- cd "$OLDPWD"
18
- local brief_file=$(find_brief_file 2>/dev/null || echo "")
19
- cd "$tmp_dir"
20
- if [ -z "$brief_file" ]; then
21
- echo "No BRIEF.md file found in docs/ or root directory. Please create one first."
22
- exit 1
23
- fi
24
-
25
- if [ ! -f "$OLDPWD/docs/PLAN.md" ]; then
26
- echo "No docs/PLAN.md file found. Please run 'claudefsd create-plan' first."
27
- exit 1
28
- fi
29
- }
30
-
31
- # Check requirements
32
- check_requirements
33
-
34
- # Create logs directory
35
- mkdir -p "$OLDPWD/logs"
36
- LOGFILE="$OLDPWD/logs/claude-dev-mini-$(date +%Y%m%d_%H%M%S).txt"
37
-
38
- echo -e "\033[32m==================================================================\033[0m"
39
- echo -e "\033[32m== CLAUDE FSD DEV-MINI: FAST PARALLEL EXECUTION MODE\033[0m"
40
- echo -e "\033[32m==================================================================\033[0m"
41
- echo
42
- echo "This mode attempts to complete the entire project in one shot using"
43
- echo "parallel Task agents. Best for smaller projects that fit in context."
44
- echo
45
-
46
- # Go back to the project directory
47
- cd "$OLDPWD"
48
-
49
- # Build the omnibus prompt
50
- omnibus_prompt="You are an elite development team leader using Claude's Task agent capabilities for rapid parallel execution.
51
-
52
- PROJECT CONTEXT:
53
- $([ -f docs/BRIEF.md ] && echo "=== PROJECT BRIEF ===" && cat docs/BRIEF.md || [ -f BRIEF.md ] && echo "=== PROJECT BRIEF ===" && cat BRIEF.md && echo "")
54
- $([ -f docs/PLAN.md ] && echo "=== DEVELOPMENT PLAN ===" && cat docs/PLAN.md && echo "")
55
- $([ -f docs/REQUIREMENTS.md ] && echo "=== REQUIREMENTS ===" && cat docs/REQUIREMENTS.md && echo "")
56
- $([ -f docs/CLAUDE-NOTES.md ] && echo "=== TECHNICAL NOTES ===" && cat docs/CLAUDE-NOTES.md && echo "")
57
- $([ -f README.md ] && echo "=== README ===" && cat README.md && echo "")
58
-
59
- IMPORTANT: Before starting ANY work, you MUST read and understand:
60
- 1. The project's CLAUDE.md file (if it exists) - this contains project-specific instructions
61
- 2. The user's global CLAUDE.md file at ~/.claude/CLAUDE.md (if it exists) - this contains general development principles
62
- 3. Ensure all your work follows the architectural and development guidelines from both files
63
-
64
- CRITICAL ANTI-PATTERNS TO AVOID (from CLAUDE.md):
65
- - NO CHEATING: Never disable tests, exclude files from compilation, or use silent fallbacks
66
- - FAIL FAST: Integration failures should throw exceptions, not return mock data
67
- - NO PRODUCTION FALLBACKS: Avoid try/catch blocks that hide errors with default values
68
- - NO BACKUP COPIES: Use git for version control, never create backup files
69
- - DELETE OLD CODE: Remove unused functions and scripts, keep the codebase clean
70
-
71
- YOUR MISSION:
72
- 1. Analyze the full project plan and identify all tasks that need to be completed
73
- 2. Group related tasks that can be done in parallel by different agents
74
- 3. Launch multiple Task agents concurrently to maximize efficiency
75
- 4. Each agent should have a clear, specific brief about what to implement
76
- 5. Coordinate the work to ensure consistency across all agents
77
-
78
- EXECUTION STRATEGY:
79
- - Read all project documentation first to understand the full scope
80
- - Create a mental map of dependencies between tasks
81
- - Launch agents for independent tasks in parallel batches
82
- - For dependent tasks, sequence them appropriately
83
- - Each agent should be given enough context to work autonomously
84
-
85
- TASK AGENT GUIDELINES FOR BRIEFS:
86
- When creating prompts for Task agents, ensure each one:
87
- - Has a clear, specific goal
88
- - Understands the project architecture and conventions
89
- - Knows about related components they might need to integrate with
90
- - Follows all CLAUDE.md guidelines
91
- - Includes relevant code style and testing requirements
92
-
93
- VERIFICATION:
94
- After all agents complete:
95
- - Review what was accomplished vs the plan
96
- - Run any tests or linters specified in the project
97
- - Summarize completion status and any issues encountered
98
-
99
- Start by analyzing the project and planning your parallel execution strategy.
100
- Then launch the Task agents to build this project rapidly and efficiently.
101
-
102
- Remember: This is a one-shot execution. Make it count!"
103
-
104
- echo "Running Claude dev-mini omnibus prompt..."
105
- echo "This will launch multiple parallel Task agents to complete the project..."
106
- echo
107
-
108
- # Run the omnibus prompt
109
- claude --dangerously-skip-permissions -p "$omnibus_prompt" 2>&1 | tee "$LOGFILE"
110
-
111
- echo
112
- echo -e "\033[32m==================================================================\033[0m"
113
- echo -e "\033[32m== DEV-MINI EXECUTION COMPLETE\033[0m"
114
- echo -e "\033[32m==================================================================\033[0m"
115
- echo
116
-
117
- # Run a verifier to check progress
118
- verifier_prompt="You are a project completion verifier.
119
-
120
- Review the work that was just completed and compare it against:
121
- $([ -f docs/PLAN.md ] && echo "=== ORIGINAL PLAN ===" && cat docs/PLAN.md && echo "")
122
-
123
- Your job:
124
- 1. List what was successfully completed
125
- 2. List what remains to be done (if anything)
126
- 3. Estimate the completion percentage
127
- 4. Identify any issues or errors encountered
128
- 5. Recommend next steps:
129
- - If mostly complete: suggest minor fixes
130
- - If significantly incomplete: recommend switching to 'claudefsd dev' mode
131
-
132
- Be honest and thorough in your assessment.
133
- Format your response clearly with sections for completed tasks, remaining tasks, and recommendations."
134
-
135
- echo "Running completion verifier..."
136
- echo
137
-
138
- claude --dangerously-skip-permissions -p "$verifier_prompt" 2>&1 | tee -a "$LOGFILE"
139
-
140
- echo
141
- echo "Full log saved to: $LOGFILE"
142
- echo
143
- echo "If the project is incomplete, you can continue with:"
144
- echo " claudefsd dev # For iterative development mode"
145
- echo
146
-
147
- # Clean up
148
- rm -rf "$tmp_dir"