claude-fsd 1.5.26 → 1.5.28
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/README.md +21 -4
- package/bin/claudefsd +31 -11
- package/bin/claudefsd-analyze-brief +3 -12
- package/bin/claudefsd-analyze-brief-personas +2 -2
- package/bin/claudefsd-create-plan +50 -20
- package/bin/claudefsd-dev +88 -34
- package/bin/claudefsd-find-brief +17 -1
- package/bin/claudefsd-interview +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,8 +83,14 @@ Runs the development agent fleet. This command:
|
|
|
83
83
|
- Updates the plan to track progress
|
|
84
84
|
- Repeats until all tasks are done
|
|
85
85
|
|
|
86
|
+
Options:
|
|
87
|
+
- `--max-time=MINUTES` - Maximum total runtime (default: 120 minutes)
|
|
88
|
+
- `--working-dir=DIR` - Directory containing BRIEF.md and PLAN.md (default: docs)
|
|
89
|
+
|
|
86
90
|
Every 4th cycle, it activates "megathinking mode" using ultrathink for deep architectural planning.
|
|
87
91
|
|
|
92
|
+
**@STOP Checkpoint**: Add `@STOP` on its own line in PLAN.md to pause when all preceding tasks complete. Useful for human review or deployment gates.
|
|
93
|
+
|
|
88
94
|
#### claudefsd-interview
|
|
89
95
|
Interactive expert Q&A session that:
|
|
90
96
|
- Analyzes your BRIEF.md with multiple AI personas (DBA, Architect, UX Expert, etc.)
|
|
@@ -137,12 +143,13 @@ This isn't sci-fi level "sleep through the entire project" automation - it's mor
|
|
|
137
143
|
- Unix-like environment (macOS, Linux)
|
|
138
144
|
- [Claude CLI](https://docs.anthropic.com/en/docs/claude-code) (`claude` command)
|
|
139
145
|
|
|
140
|
-
### Optional (but recommended)
|
|
141
|
-
- [Codex](https://github.com/Codex-ai/codex) - For enhanced code review capabilities
|
|
142
|
-
- OpenAI API key - For Codex features (set `OPENAI_API_KEY` environment variable)
|
|
143
|
-
|
|
144
146
|
## Project Structure
|
|
145
147
|
|
|
148
|
+
**Flexible Structure:** Files can be placed in either `docs/` (default) or root directory `.`
|
|
149
|
+
- System automatically detects file locations
|
|
150
|
+
- Use `docs/` for larger projects to keep files organized
|
|
151
|
+
- Use root `.` for smaller projects for simplicity
|
|
152
|
+
|
|
146
153
|
Default structure (using 'docs' as working directory):
|
|
147
154
|
```
|
|
148
155
|
your-project/
|
|
@@ -158,6 +165,16 @@ your-project/
|
|
|
158
165
|
└── [your code files]
|
|
159
166
|
```
|
|
160
167
|
|
|
168
|
+
Simple structure (files in root):
|
|
169
|
+
```
|
|
170
|
+
your-project/
|
|
171
|
+
├── BRIEF.md
|
|
172
|
+
├── PLAN.md
|
|
173
|
+
├── CLAUDE-NOTES.md
|
|
174
|
+
├── logs/
|
|
175
|
+
└── [your code files]
|
|
176
|
+
```
|
|
177
|
+
|
|
161
178
|
With custom working directory:
|
|
162
179
|
```
|
|
163
180
|
your-project/
|
package/bin/claudefsd
CHANGED
|
@@ -42,11 +42,18 @@ get_default_choice() {
|
|
|
42
42
|
source "$(dirname "$0")/claudefsd-find-brief"
|
|
43
43
|
if ! find_brief_file >/dev/null 2>&1; then
|
|
44
44
|
echo "0"
|
|
45
|
-
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
# Use flexible file detection
|
|
48
|
+
local requirements_file=$(find_project_file "REQUIREMENTS.md" 2>/dev/null || echo "")
|
|
49
|
+
local questions_file=$(find_project_file "QUESTIONS.md" 2>/dev/null || echo "")
|
|
50
|
+
local plan_file=$(find_project_file "PLAN.md" 2>/dev/null || echo "")
|
|
51
|
+
|
|
52
|
+
if [ -z "$requirements_file" ] && [ -z "$questions_file" ]; then
|
|
46
53
|
echo "1" # Interactive interview
|
|
47
|
-
elif [ -
|
|
54
|
+
elif [ -n "$requirements_file" ] && [ -z "$plan_file" ]; then
|
|
48
55
|
echo "2" # Create plan from requirements
|
|
49
|
-
elif [ -
|
|
56
|
+
elif [ -n "$questions_file" ] && [ -z "$plan_file" ]; then
|
|
50
57
|
echo "2" # Create plan from questions
|
|
51
58
|
else
|
|
52
59
|
echo "3" # Development mode
|
|
@@ -83,10 +90,14 @@ show_menu() {
|
|
|
83
90
|
echo " 1) Interview - Gather requirements through expert Q&A"
|
|
84
91
|
fi
|
|
85
92
|
|
|
86
|
-
# Show create plan option based on what exists
|
|
87
|
-
|
|
93
|
+
# Show create plan option based on what exists (use flexible detection)
|
|
94
|
+
source "$(dirname "$0")/claudefsd-find-brief"
|
|
95
|
+
local requirements_file=$(find_project_file "REQUIREMENTS.md" 2>/dev/null || echo "")
|
|
96
|
+
local questions_file=$(find_project_file "QUESTIONS.md" 2>/dev/null || echo "")
|
|
97
|
+
|
|
98
|
+
if [ -n "$requirements_file" ]; then
|
|
88
99
|
echo " 2) Create plan - Generate development plan from requirements"
|
|
89
|
-
elif [ -
|
|
100
|
+
elif [ -n "$questions_file" ]; then
|
|
90
101
|
echo " 2) Create plan - Generate plan from answered questions"
|
|
91
102
|
else
|
|
92
103
|
echo " 2) [Requires interview first]"
|
|
@@ -113,9 +124,14 @@ show_menu() {
|
|
|
113
124
|
echo " 📝 Interview session: $session_status ($total_questions questions)"
|
|
114
125
|
fi
|
|
115
126
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
# Show status with flexible file detection
|
|
128
|
+
local requirements_file=$(find_project_file "REQUIREMENTS.md" 2>/dev/null || echo "")
|
|
129
|
+
local questions_file=$(find_project_file "QUESTIONS.md" 2>/dev/null || echo "")
|
|
130
|
+
local plan_file=$(find_project_file "PLAN.md" 2>/dev/null || echo "")
|
|
131
|
+
|
|
132
|
+
[ -n "$requirements_file" ] && echo " ✓ $requirements_file exists" || echo " ✗ REQUIREMENTS.md missing"
|
|
133
|
+
[ -n "$questions_file" ] && echo " ✓ $questions_file exists" || echo " ✗ QUESTIONS.md missing"
|
|
134
|
+
[ -n "$plan_file" ] && echo " ✓ $plan_file exists" || echo " ✗ PLAN.md missing"
|
|
119
135
|
echo
|
|
120
136
|
}
|
|
121
137
|
|
|
@@ -262,8 +278,12 @@ if [ $# -eq 0 ]; then
|
|
|
262
278
|
exec "$(dirname "$0")/claudefsd-interview" --working-dir="$WORKING_DIR"
|
|
263
279
|
;;
|
|
264
280
|
2)
|
|
265
|
-
# Create plan - check what source to use
|
|
266
|
-
|
|
281
|
+
# Create plan - check what source to use (flexible detection)
|
|
282
|
+
source "$(dirname "$0")/claudefsd-find-brief"
|
|
283
|
+
requirements_file=$(find_project_file "REQUIREMENTS.md" 2>/dev/null || echo "")
|
|
284
|
+
questions_file=$(find_project_file "QUESTIONS.md" 2>/dev/null || echo "")
|
|
285
|
+
|
|
286
|
+
if [ -n "$requirements_file" ] || [ -n "$questions_file" ]; then
|
|
267
287
|
echo -e "${GREEN}Creating plan from project inputs...${NC}"
|
|
268
288
|
echo
|
|
269
289
|
exec "$(dirname "$0")/claudefsd-create-plan" --working-dir="$WORKING_DIR"
|
|
@@ -16,7 +16,7 @@ exec "$(dirname "$0")/claudefsd-analyze-brief-personas" "$@"
|
|
|
16
16
|
|
|
17
17
|
mkdir -p logs
|
|
18
18
|
|
|
19
|
-
# Use a temporary directory for tmp files
|
|
19
|
+
# Use a temporary directory for tmp files
|
|
20
20
|
mkdir -p tmp
|
|
21
21
|
export TMPDIR=tmp/
|
|
22
22
|
|
|
@@ -67,17 +67,8 @@ DO NOT answer the questions yourself - just generate them for the user to answer
|
|
|
67
67
|
"
|
|
68
68
|
|
|
69
69
|
# run BA's
|
|
70
|
-
echo "Running claude with
|
|
71
|
-
claude --model
|
|
72
|
-
|
|
73
|
-
# Only run codex if available
|
|
74
|
-
if command -v codex >/dev/null 2>&1; then
|
|
75
|
-
echo "Running codex o3 (results won't display)..."
|
|
76
|
-
codex -m o3 --full-auto -q "$prompt1" > $LOGFILE-ba2
|
|
77
|
-
else
|
|
78
|
-
echo "Warning: codex not found, skipping enhanced analysis"
|
|
79
|
-
echo "Codex not available, skipping o3 analysis" > $LOGFILE-ba2
|
|
80
|
-
fi
|
|
70
|
+
echo "Running claude with opus model with ultrathink..."
|
|
71
|
+
claude --model opus --dangerously-skip-permissions -p "$prompt1" | tee >(cat > $LOGFILE-ba1)
|
|
81
72
|
|
|
82
73
|
echo -e "\033[32m==================================================================\033[0m"
|
|
83
74
|
echo -e "\033[32m== ANALYSIS COMPLETE\033[0m"
|
|
@@ -83,7 +83,7 @@ Include only personas that are truly relevant to this project.
|
|
|
83
83
|
"
|
|
84
84
|
|
|
85
85
|
echo "Determining relevant expert personas..."
|
|
86
|
-
PERSONAS=$(claude --model
|
|
86
|
+
PERSONAS=$(claude --model opus -p "$coordinator_prompt" 2>/dev/null | tail -1)
|
|
87
87
|
|
|
88
88
|
# Clean up and validate personas
|
|
89
89
|
PERSONAS=$(echo "$PERSONAS" | tr -d ' \n\r')
|
|
@@ -172,7 +172,7 @@ Output ONLY the questions, one per line, no numbering or bullets.
|
|
|
172
172
|
"
|
|
173
173
|
|
|
174
174
|
# Generate questions
|
|
175
|
-
QUESTIONS=$(claude --model
|
|
175
|
+
QUESTIONS=$(claude --model opus -p "$batch_prompt" 2>/dev/null)
|
|
176
176
|
|
|
177
177
|
# Add section header
|
|
178
178
|
echo "" >> "$WORKING_DIR/QUESTIONS.md"
|
|
@@ -19,7 +19,7 @@ $(dirname "$0")/claudefsd-check-dependencies
|
|
|
19
19
|
|
|
20
20
|
mkdir -p logs
|
|
21
21
|
|
|
22
|
-
# Use a temporary directory for tmp files
|
|
22
|
+
# Use a temporary directory for tmp files
|
|
23
23
|
mkdir -p tmp
|
|
24
24
|
export TMPDIR=tmp/
|
|
25
25
|
|
|
@@ -31,8 +31,12 @@ if [ $? -ne 0 ]; then
|
|
|
31
31
|
exit 1
|
|
32
32
|
fi
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
# Check for required input files using flexible detection
|
|
35
|
+
questions_file=$(find_project_file "QUESTIONS.md" 2>/dev/null || echo "")
|
|
36
|
+
requirements_file=$(find_project_file "REQUIREMENTS.md" 2>/dev/null || echo "")
|
|
37
|
+
|
|
38
|
+
if [ -z "$questions_file" ] && [ -z "$requirements_file" ]; then
|
|
39
|
+
echo "No QUESTIONS.md or REQUIREMENTS.md found in $WORKING_DIR/ or root directory."
|
|
36
40
|
echo "Please run either:"
|
|
37
41
|
echo " - 'claudefsd analyze-brief' to generate questions, or"
|
|
38
42
|
echo " - 'claudefsd interview' to conduct an interactive interview"
|
|
@@ -45,22 +49,48 @@ echo -e "\033[32m===============================================================
|
|
|
45
49
|
echo -e "\033[32m== CREATING PLAN FROM PROJECT INPUTS\033[0m"
|
|
46
50
|
echo -e "\033[32m==================================================================\033[0m"
|
|
47
51
|
|
|
52
|
+
# Build list of files to read (using flexible paths)
|
|
53
|
+
plan_file=$(find_project_file "PLAN.md" 2>/dev/null || echo "")
|
|
54
|
+
notes_file=$(find_project_file "CLAUDE-NOTES.md" 2>/dev/null || echo "")
|
|
55
|
+
ideas_file=$(find_project_file "IDEAS.md" 2>/dev/null || echo "")
|
|
56
|
+
webtests_file=$(find_project_file "WEBTESTS.md" 2>/dev/null || echo "")
|
|
57
|
+
readme_file=$(find_project_file "README.md" 2>/dev/null || echo "")
|
|
58
|
+
|
|
59
|
+
# Build file list for prompt
|
|
60
|
+
file_list="- $BRIEF_FILE -- the project brief"
|
|
61
|
+
[ -n "$questions_file" ] && file_list="$file_list
|
|
62
|
+
- $questions_file -- the project questions (with answers) from analyze-brief or interview"
|
|
63
|
+
[ -n "$requirements_file" ] && file_list="$file_list
|
|
64
|
+
- $requirements_file -- consolidated requirements from interview process"
|
|
65
|
+
[ -n "$notes_file" ] && file_list="$file_list
|
|
66
|
+
- $notes_file -- AI's working notes and understanding"
|
|
67
|
+
[ -n "$plan_file" ] && file_list="$file_list
|
|
68
|
+
- $plan_file -- the project plan"
|
|
69
|
+
[ -n "$ideas_file" ] && file_list="$file_list
|
|
70
|
+
- $ideas_file -- the backlog of future ideas"
|
|
71
|
+
[ -n "$webtests_file" ] && file_list="$file_list
|
|
72
|
+
- $webtests_file -- the project web tests"
|
|
73
|
+
[ -n "$readme_file" ] && file_list="$file_list
|
|
74
|
+
- $readme_file -- the project README"
|
|
75
|
+
|
|
76
|
+
# Determine output paths (prefer working dir if it exists, otherwise root)
|
|
77
|
+
if [ -d "$WORKING_DIR" ] && [ "$WORKING_DIR" != "." ]; then
|
|
78
|
+
output_notes="$WORKING_DIR/CLAUDE-NOTES.md"
|
|
79
|
+
output_plan="$WORKING_DIR/PLAN.md"
|
|
80
|
+
else
|
|
81
|
+
output_notes="CLAUDE-NOTES.md"
|
|
82
|
+
output_plan="PLAN.md"
|
|
83
|
+
fi
|
|
84
|
+
|
|
48
85
|
prompt2="
|
|
49
86
|
Read and analyze these project files if they exist:
|
|
50
|
-
|
|
51
|
-
- $WORKING_DIR/QUESTIONS.md -- the project questions (with answers) from analyze-brief or interview
|
|
52
|
-
- $WORKING_DIR/REQUIREMENTS.md -- consolidated requirements from interview process
|
|
53
|
-
- $WORKING_DIR/CLAUDE-NOTES.md -- AI's working notes and understanding
|
|
54
|
-
- $WORKING_DIR/PLAN.md -- the project plan
|
|
55
|
-
- $WORKING_DIR/IDEAS.md -- the backlog of future ideas
|
|
56
|
-
- $WORKING_DIR/WEBTESTS.md -- the project web tests
|
|
57
|
-
- $WORKING_DIR/README.md -- the project README (if exists in working directory)
|
|
87
|
+
$file_list
|
|
58
88
|
|
|
59
89
|
Your job, as a megathinking architect and project manager, is to create the project plan and working notes.
|
|
60
90
|
|
|
61
|
-
1. Read through the BRIEF.md and any available requirements/questions
|
|
62
|
-
2. Update or create $
|
|
63
|
-
3. Update or create $
|
|
91
|
+
1. Read through the BRIEF.md and any available requirements/questions.
|
|
92
|
+
2. Update or create $output_notes with your interpretation and understanding of the project.
|
|
93
|
+
3. Update or create $output_plan with a detailed implementation plan based on all available inputs.
|
|
64
94
|
|
|
65
95
|
The CLAUDE-NOTES.md should contain:
|
|
66
96
|
- Your understanding of the project goals and requirements
|
|
@@ -71,7 +101,7 @@ The CLAUDE-NOTES.md should contain:
|
|
|
71
101
|
The PLAN.md should contain:
|
|
72
102
|
- Master plan limited to 100 lines maximum
|
|
73
103
|
- High-level sections with [ ] checkboxes for completion tracking
|
|
74
|
-
- For complex projects, reference detailed sub-plans in separate files (
|
|
104
|
+
- For complex projects, reference detailed sub-plans in separate files (plan-section1.md, plan-section2.md, etc.)
|
|
75
105
|
- Include proportional infrastructure setup (basic linting + pre-commit hooks)
|
|
76
106
|
- Group related tasks into logical phases
|
|
77
107
|
- If the plan would exceed 100 lines, create a master plan with section references and detailed sub-plans
|
|
@@ -102,15 +132,15 @@ Take your time to think deeply about the best solution before generating your pl
|
|
|
102
132
|
# Prepend ultrathink to the prompt
|
|
103
133
|
prompt2="$ultrathink_instruction$prompt2"
|
|
104
134
|
|
|
105
|
-
# Run planning with
|
|
106
|
-
echo "Running claude with
|
|
107
|
-
claude --model
|
|
135
|
+
# Run planning with opus + ultrathink
|
|
136
|
+
echo "Running claude with opus model (ultrathink mode)..."
|
|
137
|
+
claude --model opus --dangerously-skip-permissions -p "$prompt2" | tee >(cat > $LOGFILE-ba3)
|
|
108
138
|
|
|
109
139
|
echo -e "\033[32m==================================================================\033[0m"
|
|
110
140
|
echo -e "\033[32m== PLAN CREATION COMPLETE\033[0m"
|
|
111
141
|
echo -e "\033[32m==================================================================\033[0m"
|
|
112
|
-
echo "Plan created in $
|
|
113
|
-
echo "Working notes saved in $
|
|
142
|
+
echo "Plan created in $output_plan"
|
|
143
|
+
echo "Working notes saved in $output_notes"
|
|
114
144
|
echo "You can now run 'claudefsd dev' to start the development process."
|
|
115
145
|
|
|
116
146
|
|
package/bin/claudefsd-dev
CHANGED
|
@@ -1,28 +1,43 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
#
|
|
3
3
|
# Main development mode - intelligent task selection with parallel execution
|
|
4
|
-
# Usage: claudefsd-dev
|
|
4
|
+
# Usage: claudefsd-dev [--working-dir=DIR] [--max-time=MINUTES]
|
|
5
|
+
#
|
|
6
|
+
# Options:
|
|
7
|
+
# --working-dir=DIR Directory containing BRIEF.md and PLAN.md (default: docs)
|
|
8
|
+
# --max-time=MINUTES Maximum total runtime in minutes (default: 120)
|
|
5
9
|
#
|
|
6
10
|
# Features:
|
|
7
11
|
# - Fail-fast loop detection and "all done" prompt from iterative mode
|
|
8
12
|
# - Direct parallel Task agent execution from direct mode
|
|
9
13
|
# - Intelligent task planning and coordination
|
|
14
|
+
# - @STOP marker support: stops when all tasks before @STOP are complete
|
|
15
|
+
# - Max runtime limit to prevent runaway sessions
|
|
10
16
|
#
|
|
11
17
|
|
|
12
18
|
#set -e
|
|
13
19
|
|
|
14
|
-
# Parse
|
|
20
|
+
# Parse command line parameters
|
|
15
21
|
WORKING_DIR="docs"
|
|
22
|
+
MAX_TIME_MINUTES=120
|
|
16
23
|
for arg in "$@"; do
|
|
17
24
|
case $arg in
|
|
18
25
|
--working-dir=*)
|
|
19
26
|
WORKING_DIR="${arg#*=}"
|
|
20
27
|
shift
|
|
21
28
|
;;
|
|
29
|
+
--max-time=*)
|
|
30
|
+
MAX_TIME_MINUTES="${arg#*=}"
|
|
31
|
+
shift
|
|
32
|
+
;;
|
|
22
33
|
esac
|
|
23
34
|
done
|
|
24
35
|
export CLAUDEFSD_WORKING_DIR="$WORKING_DIR"
|
|
25
36
|
|
|
37
|
+
# Convert max time to seconds and record start time
|
|
38
|
+
MAX_TIME_SECONDS=$((MAX_TIME_MINUTES * 60))
|
|
39
|
+
OVERALL_START_TIME=$(date +%s)
|
|
40
|
+
|
|
26
41
|
# Get the actual location of this script (resolving symlinks)
|
|
27
42
|
if command -v realpath >/dev/null 2>&1; then
|
|
28
43
|
SCRIPT_PATH="$(realpath "$0")"
|
|
@@ -46,17 +61,18 @@ SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
|
|
|
46
61
|
|
|
47
62
|
# Function to check for required files
|
|
48
63
|
check_requirements() {
|
|
49
|
-
# Load
|
|
64
|
+
# Load file finding functions
|
|
50
65
|
source "$SCRIPT_DIR/claudefsd-find-brief"
|
|
51
66
|
brief_file=$(find_brief_file 2>/dev/null || echo "")
|
|
52
|
-
|
|
67
|
+
|
|
53
68
|
if [ -z "$brief_file" ]; then
|
|
54
69
|
echo "No BRIEF.md file found in $WORKING_DIR/ or root directory. Please create one first."
|
|
55
70
|
exit 1
|
|
56
71
|
fi
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
72
|
+
|
|
73
|
+
plan_file=$(find_project_file "PLAN.md" 2>/dev/null || echo "")
|
|
74
|
+
if [ -z "$plan_file" ]; then
|
|
75
|
+
echo "No PLAN.md file found in $WORKING_DIR/ or root directory. Please run 'claudefsd create-plan' first."
|
|
60
76
|
exit 1
|
|
61
77
|
fi
|
|
62
78
|
}
|
|
@@ -107,10 +123,10 @@ Take your time to think deeply about the optimal approach before proceeding.
|
|
|
107
123
|
</ultrathink>
|
|
108
124
|
|
|
109
125
|
"
|
|
110
|
-
CLAUDE_MODEL="
|
|
126
|
+
CLAUDE_MODEL="opus"
|
|
111
127
|
else
|
|
112
128
|
MEGATHINKING_MODE=""
|
|
113
|
-
CLAUDE_MODEL="
|
|
129
|
+
CLAUDE_MODEL="opus"
|
|
114
130
|
fi
|
|
115
131
|
|
|
116
132
|
# Build the development prompt combining intelligent task selection with parallel execution
|
|
@@ -119,37 +135,43 @@ You are an elite AI developer working in an automated development environment. Y
|
|
|
119
135
|
|
|
120
136
|
**PROJECT FILES TO READ AND ANALYZE:**"
|
|
121
137
|
|
|
122
|
-
# Build file list
|
|
138
|
+
# Build file list using flexible file detection
|
|
123
139
|
source "$SCRIPT_DIR/claudefsd-find-brief"
|
|
140
|
+
|
|
124
141
|
brief_file=$(find_brief_file 2>/dev/null || echo "")
|
|
125
142
|
if [ -n "$brief_file" ]; then
|
|
126
143
|
DEVELOPMENT_PROMPT="$DEVELOPMENT_PROMPT
|
|
127
144
|
- $brief_file (project brief)"
|
|
128
145
|
fi
|
|
129
|
-
|
|
130
|
-
|
|
146
|
+
|
|
147
|
+
plan_file=$(find_project_file "PLAN.md" 2>/dev/null || echo "")
|
|
148
|
+
if [ -n "$plan_file" ]; then
|
|
131
149
|
DEVELOPMENT_PROMPT="$DEVELOPMENT_PROMPT
|
|
132
|
-
- $
|
|
150
|
+
- $plan_file (development plan with tasks)"
|
|
133
151
|
fi
|
|
134
|
-
|
|
135
|
-
|
|
152
|
+
|
|
153
|
+
requirements_file=$(find_project_file "REQUIREMENTS.md" 2>/dev/null || echo "")
|
|
154
|
+
if [ -n "$requirements_file" ]; then
|
|
136
155
|
DEVELOPMENT_PROMPT="$DEVELOPMENT_PROMPT
|
|
137
|
-
- $
|
|
156
|
+
- $requirements_file (project requirements)"
|
|
138
157
|
fi
|
|
139
|
-
|
|
140
|
-
|
|
158
|
+
|
|
159
|
+
questions_file=$(find_project_file "QUESTIONS.md" 2>/dev/null || echo "")
|
|
160
|
+
if [ -n "$questions_file" ]; then
|
|
141
161
|
DEVELOPMENT_PROMPT="$DEVELOPMENT_PROMPT
|
|
142
|
-
- $
|
|
162
|
+
- $questions_file (interview Q&A)"
|
|
143
163
|
fi
|
|
144
|
-
|
|
145
|
-
|
|
164
|
+
|
|
165
|
+
notes_file=$(find_project_file "CLAUDE-NOTES.md" 2>/dev/null || echo "")
|
|
166
|
+
if [ -n "$notes_file" ]; then
|
|
146
167
|
DEVELOPMENT_PROMPT="$DEVELOPMENT_PROMPT
|
|
147
|
-
- $
|
|
168
|
+
- $notes_file (technical notes)"
|
|
148
169
|
fi
|
|
149
|
-
|
|
150
|
-
|
|
170
|
+
|
|
171
|
+
readme_file=$(find_project_file "README.md" 2>/dev/null || echo "")
|
|
172
|
+
if [ -n "$readme_file" ]; then
|
|
151
173
|
DEVELOPMENT_PROMPT="$DEVELOPMENT_PROMPT
|
|
152
|
-
- $
|
|
174
|
+
- $readme_file (project readme)"
|
|
153
175
|
fi
|
|
154
176
|
|
|
155
177
|
if [ -f "CLAUDE.md" ]; then
|
|
@@ -179,7 +201,7 @@ You are an elite AI developer working in an automated development environment. Y
|
|
|
179
201
|
**YOUR MISSION:**
|
|
180
202
|
|
|
181
203
|
**PHASE 1: TASK SELECTION**
|
|
182
|
-
1. Read $
|
|
204
|
+
1. Read $plan_file and work through tasks in order
|
|
183
205
|
2. If a phase references a sub-plan file, read that file as well
|
|
184
206
|
3. Complete tasks in the order they appear - don't skip ahead
|
|
185
207
|
4. Identify if tasks can be done in parallel
|
|
@@ -189,7 +211,7 @@ Choose the optimal approach:
|
|
|
189
211
|
|
|
190
212
|
**Option A: Single Focus Task** (for sequential dependencies or complex architectural work)
|
|
191
213
|
- Implement the next task in order using appropriate tools (Edit, Write, Bash, etc.)
|
|
192
|
-
- Update $
|
|
214
|
+
- Update $plan_file to mark task as complete with [x]
|
|
193
215
|
|
|
194
216
|
**Option B: Parallel Task Execution** (for independent tasks)
|
|
195
217
|
- Identify 2-4 related but independent tasks that can be done simultaneously
|
|
@@ -199,13 +221,13 @@ Choose the optimal approach:
|
|
|
199
221
|
|
|
200
222
|
**PHASE 3: COMPLETION CHECK**
|
|
201
223
|
After completing work:
|
|
202
|
-
1. Update $
|
|
224
|
+
1. Update $plan_file to reflect completed tasks
|
|
203
225
|
2. Run any linters or tests specified in the project
|
|
204
226
|
3. Report on what was accomplished and what remains
|
|
205
227
|
|
|
206
228
|
**EXECUTION GUIDELINES:**
|
|
207
229
|
- **BUILD BULLETPROOF**: Create robust solutions that handle edge cases
|
|
208
|
-
- **STAY FOCUSED**: Only implement what's specified in $
|
|
230
|
+
- **STAY FOCUSED**: Only implement what's specified in $plan_file
|
|
209
231
|
- **QUALITY FIRST**: Proper error handling, testing, and documentation
|
|
210
232
|
- **ARCHITECTURAL THINKING**: Consider long-term maintainability
|
|
211
233
|
|
|
@@ -220,10 +242,10 @@ When using parallel Task agents, ensure each one:
|
|
|
220
242
|
**OUTPUT FORMAT:**
|
|
221
243
|
1. **<task_analysis>**: List identified open tasks and selected approach
|
|
222
244
|
2. **<execution>**: Details of your ACTUAL implementation work (code written, files edited, commands run)
|
|
223
|
-
3. **<plan_updates>**: How you updated $
|
|
245
|
+
3. **<plan_updates>**: How you updated $plan_file to reflect progress
|
|
224
246
|
4. **<completion_check>**: Status of remaining work
|
|
225
247
|
|
|
226
|
-
IMPORTANT: You must ACTUALLY IMPLEMENT tasks, not just describe what should be done. Use Edit, Write, Bash, and Task tools to complete real work. Begin by analyzing $
|
|
248
|
+
IMPORTANT: You must ACTUALLY IMPLEMENT tasks, not just describe what should be done. Use Edit, Write, Bash, and Task tools to complete real work. Begin by analyzing $plan_file and then IMPLEMENT the next task in order."
|
|
227
249
|
|
|
228
250
|
# Save the prompt to the log file first
|
|
229
251
|
echo "=== DEVELOPMENT PROMPT ===" > $LOGFILE
|
|
@@ -243,7 +265,7 @@ IMPORTANT: You must ACTUALLY IMPLEMENT tasks, not just describe what should be d
|
|
|
243
265
|
echo -e "\033[32m== REVIEWING/VERIFYING WORK\033[0m"
|
|
244
266
|
echo -e "\033[32m==================================================================\033[0m"
|
|
245
267
|
|
|
246
|
-
# Define the verifier prompt
|
|
268
|
+
# Define the verifier prompt (reuse plan_file from earlier)
|
|
247
269
|
VERIFIER_PROMPT="You are an expert code reviewer tasked with verifying a developer's work.
|
|
248
270
|
|
|
249
271
|
**DEVELOPER'S OUTPUT:**
|
|
@@ -254,13 +276,13 @@ $DEVELOPER_OUTPUT
|
|
|
254
276
|
2. Verify the work was actually completed by checking files
|
|
255
277
|
3. Look for any cheating patterns (disabled tests, silent fallbacks, etc.)
|
|
256
278
|
4. Create a git commit (see guidelines below)
|
|
257
|
-
5. Check if ALL tasks in $
|
|
279
|
+
5. Check if ALL tasks in $plan_file are now complete
|
|
258
280
|
|
|
259
281
|
**VERIFICATION CHECKLIST:**
|
|
260
282
|
- Did the developer actually implement code (not just analyze)?
|
|
261
283
|
- Are all changes working correctly?
|
|
262
284
|
- Do tests pass (if applicable)?
|
|
263
|
-
- Is the task properly marked as complete in $
|
|
285
|
+
- Is the task properly marked as complete in $plan_file?
|
|
264
286
|
|
|
265
287
|
**GIT COMMIT GUIDELINES:**
|
|
266
288
|
- If the code looks good: Definitely commit with a clear message
|
|
@@ -294,6 +316,38 @@ Be thorough but concise in your verification."
|
|
|
294
316
|
exit 0
|
|
295
317
|
fi
|
|
296
318
|
|
|
319
|
+
# Check for @STOP marker in plan file - if all tasks before @STOP are complete, pause for human review
|
|
320
|
+
if [ -n "$plan_file" ] && grep -q "@STOP" "$plan_file"; then
|
|
321
|
+
# Extract content before @STOP and check if any tasks are incomplete
|
|
322
|
+
BEFORE_STOP=$(sed -n '1,/@STOP/p' "$plan_file")
|
|
323
|
+
# Check for incomplete tasks ([ ] or - [ ]) before @STOP
|
|
324
|
+
if ! echo "$BEFORE_STOP" | grep -qE '\[ \]'; then
|
|
325
|
+
echo -e "\033[33m==================================================================\033[0m"
|
|
326
|
+
echo -e "\033[33m== @STOP CHECKPOINT REACHED\033[0m"
|
|
327
|
+
echo -e "\033[33m==================================================================\033[0m"
|
|
328
|
+
echo -e "\033[33mAll tasks before @STOP marker are complete.\033[0m"
|
|
329
|
+
echo -e "\033[33mPausing for human review/deployment/intervention.\033[0m"
|
|
330
|
+
echo -e "\033[33mTo continue: remove or move @STOP in $plan_file, then restart.\033[0m"
|
|
331
|
+
echo -e "\033[33m==================================================================\033[0m"
|
|
332
|
+
exit 0
|
|
333
|
+
fi
|
|
334
|
+
fi
|
|
335
|
+
|
|
336
|
+
# Check if max runtime has been exceeded
|
|
337
|
+
CURRENT_TIME=$(date +%s)
|
|
338
|
+
ELAPSED_SECONDS=$((CURRENT_TIME - OVERALL_START_TIME))
|
|
339
|
+
ELAPSED_MINUTES=$((ELAPSED_SECONDS / 60))
|
|
340
|
+
if [ $ELAPSED_SECONDS -ge $MAX_TIME_SECONDS ]; then
|
|
341
|
+
echo -e "\033[33m==================================================================\033[0m"
|
|
342
|
+
echo -e "\033[33m== MAX RUNTIME REACHED (${ELAPSED_MINUTES}m / ${MAX_TIME_MINUTES}m)\033[0m"
|
|
343
|
+
echo -e "\033[33m==================================================================\033[0m"
|
|
344
|
+
echo -e "\033[33mStopping after ${MAX_TIME_MINUTES} minutes as configured.\033[0m"
|
|
345
|
+
echo -e "\033[33mTo continue: restart with 'claudefsd dev' or increase --max-time\033[0m"
|
|
346
|
+
echo -e "\033[33m==================================================================\033[0m"
|
|
347
|
+
exit 0
|
|
348
|
+
fi
|
|
349
|
+
echo -e "\033[36mTotal runtime: ${ELAPSED_MINUTES}m / ${MAX_TIME_MINUTES}m\033[0m"
|
|
350
|
+
|
|
297
351
|
# Calculate iteration duration and check for failure patterns
|
|
298
352
|
ITERATION_END_TIME=$(date +%s)
|
|
299
353
|
ITERATION_DURATION=$((ITERATION_END_TIME - ITERATION_START_TIME))
|
package/bin/claudefsd-find-brief
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
find_brief_file() {
|
|
6
6
|
# Use environment variable if set, otherwise default to "docs"
|
|
7
7
|
local working_dir="${CLAUDEFSD_WORKING_DIR:-docs}"
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
if [ -f "$working_dir/BRIEF.md" ]; then
|
|
10
10
|
echo "$working_dir/BRIEF.md"
|
|
11
11
|
elif [ -f "BRIEF.md" ]; then
|
|
@@ -15,6 +15,22 @@ find_brief_file() {
|
|
|
15
15
|
fi
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
# Generic function to find any file in working dir or root
|
|
19
|
+
# Usage: find_project_file "PLAN.md"
|
|
20
|
+
# Returns: path to file (prefers $WORKING_DIR/file, falls back to ./file)
|
|
21
|
+
find_project_file() {
|
|
22
|
+
local filename="$1"
|
|
23
|
+
local working_dir="${CLAUDEFSD_WORKING_DIR:-docs}"
|
|
24
|
+
|
|
25
|
+
if [ -f "$working_dir/$filename" ]; then
|
|
26
|
+
echo "$working_dir/$filename"
|
|
27
|
+
elif [ -f "$filename" ]; then
|
|
28
|
+
echo "$filename"
|
|
29
|
+
else
|
|
30
|
+
return 1
|
|
31
|
+
fi
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
# If called directly, just output the path
|
|
19
35
|
if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
|
|
20
36
|
find_brief_file
|
package/bin/claudefsd-interview
CHANGED
|
@@ -193,7 +193,7 @@ prepare_next_question_bg() {
|
|
|
193
193
|
coordinator_prompt="${coordinator_prompt//\{qa_summary_by_domain\}/$qa_summary}"
|
|
194
194
|
|
|
195
195
|
# Get coordinator decision
|
|
196
|
-
local next_persona=$(claude --model
|
|
196
|
+
local next_persona=$(claude --model opus -p "$coordinator_prompt" 2>/dev/null | tail -1)
|
|
197
197
|
|
|
198
198
|
# Validate and clean decision - remove spaces, newlines, and markdown formatting
|
|
199
199
|
next_persona=$(echo "$next_persona" | tr -d ' \n\r' | sed 's/[*_`]//g')
|
|
@@ -312,7 +312,7 @@ ${prompt_template}"
|
|
|
312
312
|
prompt_template="${prompt_template//\{security_qa_history\}/$persona_qa}"
|
|
313
313
|
|
|
314
314
|
# Get question from Claude
|
|
315
|
-
local question=$(claude --model
|
|
315
|
+
local question=$(claude --model opus -p "$prompt_template" 2>/dev/null | tail -1)
|
|
316
316
|
echo "$question" > "$QUESTION_CACHE"
|
|
317
317
|
|
|
318
318
|
# Question is ready in cache, no output needed
|
|
@@ -384,7 +384,7 @@ Create a comprehensive requirements document that:
|
|
|
384
384
|
Format the output as a clean, well-structured markdown document suitable for feeding into project planning.
|
|
385
385
|
"
|
|
386
386
|
|
|
387
|
-
claude --model
|
|
387
|
+
claude --model opus -p "$consolidation_prompt" > "$REQUIREMENTS_FILE"
|
|
388
388
|
|
|
389
389
|
echo -e "${GREEN}Requirements consolidated in $REQUIREMENTS_FILE${NC}"
|
|
390
390
|
|