claude-fsd 1.3.4 โ 1.3.6
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 +53 -23
- package/bin/claudefsd-dev +207 -108
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
# claude-fsd
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Automated project development - let AI build your project while you sleep.
|
|
4
4
|
|
|
5
5
|
## What is this?
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
claude-fsd is an automated development system that runs continuous development cycles without constant supervision. Write a brief description of what you want, answer some clarifying questions, then let it build your project autonomously.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Think of it like **Tesla FSD for code** - it handles the driving, but you should keep an eye on it and occasionally take the wheel when needed.
|
|
10
|
+
|
|
11
|
+
### How the Agent System Works
|
|
12
|
+
|
|
13
|
+
The system operates with multiple specialized AI agents working together:
|
|
10
14
|
|
|
11
15
|
- ๐งโ๐ป **Developer Agent**: Writes code, implements features, fixes bugs
|
|
12
|
-
- ๐ **Planner Agent**: Breaks down tasks, manages the development roadmap
|
|
16
|
+
- ๐ **Planner Agent**: Breaks down tasks, manages the development roadmap
|
|
13
17
|
- ๐ **Reviewer Agent**: Reviews code quality, catches issues, ensures best practices
|
|
14
18
|
- ๐งช **Tester Agent**: Runs tests, validates changes, commits clean code
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
The agents work in continuous cycles:
|
|
21
|
+
```
|
|
22
|
+
Plan โ Develop โ Review โ Test โ Commit โ Repeat
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
You can leave it running while you grab lunch or sleep - it just keeps going until it thinks the project is complete.
|
|
17
26
|
|
|
18
27
|
## Installation
|
|
19
28
|
|
|
@@ -23,12 +32,15 @@ npm install -g claude-fsd
|
|
|
23
32
|
|
|
24
33
|
## Quick Start
|
|
25
34
|
|
|
26
|
-
Just run:
|
|
27
35
|
```bash
|
|
28
|
-
claude-fsd
|
|
36
|
+
claude-fsd
|
|
29
37
|
```
|
|
30
38
|
|
|
31
|
-
|
|
39
|
+
The system will walk you through the setup process:
|
|
40
|
+
|
|
41
|
+
1. **Create a BRIEF.md** - Write a short description of what you want to build
|
|
42
|
+
2. **Answer questions in QUESTIONS.md** - The AI will generate clarifying questions for you to answer
|
|
43
|
+
3. **Let it rip** - Start the automated development process
|
|
32
44
|
|
|
33
45
|
## Commands
|
|
34
46
|
|
|
@@ -71,17 +83,34 @@ Generates an initial project plan from scratch based on:
|
|
|
71
83
|
|
|
72
84
|
## How it Works
|
|
73
85
|
|
|
74
|
-
1. **
|
|
75
|
-
2. **AI
|
|
76
|
-
3. **
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
1. **Write a BRIEF.md** - Describe what you want to build
|
|
87
|
+
2. **Answer AI-generated questions** in `QUESTIONS.md`
|
|
88
|
+
3. **Start the development loop** - The system automatically:
|
|
89
|
+
- Picks the next task from your plan
|
|
90
|
+
- Implements the feature
|
|
91
|
+
- Reviews the code
|
|
92
|
+
- Runs tests and commits changes
|
|
93
|
+
- Repeats until complete
|
|
80
94
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
## Monitoring Progress (Like Tesla FSD)
|
|
96
|
+
|
|
97
|
+
This isn't sci-fi level "sleep through the entire project" automation - it's more like Tesla FSD. The system handles most of the work, but you should monitor it and be ready to intervene when needed.
|
|
98
|
+
|
|
99
|
+
**Recommended monitoring approach:**
|
|
100
|
+
- **Run a parallel Claude session** - Open another Claude window/tab to chat about the project
|
|
101
|
+
- **Check status periodically** - Ask the parallel Claude: "What's the current status of my project?"
|
|
102
|
+
- **Review the plan** - Look at `docs/PLAN.md` to see what's been completed and what's next
|
|
103
|
+
- **Watch for drift** - If the system goes off track, intervene before it gets too far
|
|
104
|
+
|
|
105
|
+
**When you need to course-correct:**
|
|
106
|
+
- **Update the plan** - Add urgent fixes or redirections to the top of `docs/PLAN.md`
|
|
107
|
+
- **Direct intervention** - Use your parallel Claude session to directly fix issues
|
|
108
|
+
- **The system adapts** - claude-fsd will pick up plan changes on the next loop iteration
|
|
109
|
+
|
|
110
|
+
**Interruptible design:**
|
|
111
|
+
- Hit Ctrl+C anytime to pause
|
|
112
|
+
- Restart later with `claude-fsd dev`
|
|
113
|
+
- Perfect for running overnight, during meetings, or while getting lunch
|
|
85
114
|
|
|
86
115
|
## Requirements
|
|
87
116
|
|
|
@@ -110,11 +139,12 @@ your-project/
|
|
|
110
139
|
|
|
111
140
|
## Tips for Success
|
|
112
141
|
|
|
113
|
-
1. **
|
|
114
|
-
2. **
|
|
115
|
-
3. **
|
|
116
|
-
4. **Use
|
|
117
|
-
5. **Trust
|
|
142
|
+
1. **Keep your BRIEF.md concise** - A few clear paragraphs work better than lengthy specifications
|
|
143
|
+
2. **Answer questions thoroughly** - The AI's questions help it understand your exact needs
|
|
144
|
+
3. **Monitor periodically** - Check progress while it runs, especially during initial cycles
|
|
145
|
+
4. **Use the plan as your steering wheel** - Update `docs/PLAN.md` to guide development direction
|
|
146
|
+
5. **Trust the process** - Let it run autonomously, but verify the results
|
|
147
|
+
|
|
118
148
|
|
|
119
149
|
## License
|
|
120
150
|
|
package/bin/claudefsd-dev
CHANGED
|
@@ -8,7 +8,14 @@ $(dirname "$0")/claudefsd-check-dependencies
|
|
|
8
8
|
# Add counter for loop iterations
|
|
9
9
|
LOOP_COUNTER=0
|
|
10
10
|
|
|
11
|
+
# Failure detection variables
|
|
12
|
+
CONSECUTIVE_FAST_ITERATIONS=0
|
|
13
|
+
MIN_ITERATION_TIME=300 # 5 minutes in seconds
|
|
14
|
+
|
|
11
15
|
while true; do
|
|
16
|
+
# Record iteration start time
|
|
17
|
+
ITERATION_START_TIME=$(date +%s)
|
|
18
|
+
|
|
12
19
|
# Increment loop counter
|
|
13
20
|
LOOP_COUNTER=$((LOOP_COUNTER + 1))
|
|
14
21
|
|
|
@@ -35,19 +42,46 @@ while true; do
|
|
|
35
42
|
|
|
36
43
|
time claude -p "
|
|
37
44
|
$MEGATHINKING_MODE
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
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.
|
|
46
|
+
|
|
47
|
+
Please follow these steps to complete your task:
|
|
48
|
+
|
|
49
|
+
1. Read the contents of docs/PLAN.md in order.
|
|
50
|
+
2. Identify all open tasks that need to be done by the developer.
|
|
51
|
+
3. Gather related context from docs/PLAN.md, BRIEF.md, docs/QUESTIONS.md, and docs/CLAUDE-NOTES.md.
|
|
52
|
+
4. Consider the bigger picture of the project and potential impacts of each task.
|
|
53
|
+
5. Evaluate the risk and efficiency of potential changes for each task.
|
|
54
|
+
6. Prioritize the tasks based primarily on their order in the plan, but also factor in importance, risk, and efficiency.
|
|
55
|
+
7. Select the most appropriate next task and formulate a response that includes the task description and relevant context.
|
|
56
|
+
|
|
57
|
+
In your analysis, please consider the following:
|
|
58
|
+
- Include any sub-bullet points or section information related to the tasks.
|
|
59
|
+
- Think about how each task fits into the overall project goals.
|
|
60
|
+
- Be aware of potential bottlenecks or situations where a single fix might resolve multiple issues.
|
|
61
|
+
- Consider dependencies between tasks and how they might affect prioritization.
|
|
62
|
+
|
|
63
|
+
Before providing your final task description, wrap your analysis inside <analysis> tags in your thinking block. This should include:
|
|
64
|
+
- A list of all open tasks identified from docs/PLAN.md
|
|
65
|
+
- An evaluation of each task's priority, risk, and efficiency
|
|
66
|
+
- Consideration of task dependencies
|
|
67
|
+
- Your reasoning for the final task selection, including how it fits into the project's broader context
|
|
68
|
+
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
If the plan is complete and there are no more tasks to be done, simply respond with <ALL DONE>.
|
|
72
|
+
|
|
73
|
+
Example output structure:
|
|
74
|
+
|
|
75
|
+
<analysis>
|
|
76
|
+
[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]
|
|
77
|
+
</analysis>
|
|
78
|
+
|
|
79
|
+
<task_description>
|
|
80
|
+
[A concise description of the next task, including relevant context and considerations]
|
|
81
|
+
</task_description>
|
|
82
|
+
|
|
83
|
+
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.
|
|
84
|
+
|
|
51
85
|
" | tee >(cat > $LOGFILE-planner)
|
|
52
86
|
|
|
53
87
|
nexttask=$(cat $LOGFILE-planner)
|
|
@@ -65,80 +99,77 @@ If the plan is complete, say <ALL DONE>.
|
|
|
65
99
|
# run the task
|
|
66
100
|
time claude --dangerously-skip-permissions -p "
|
|
67
101
|
$MEGATHINKING_MODE
|
|
68
|
-
You are an AI developer working within an automated development environment. Your role is
|
|
69
|
-
to complete tasks, plan implementations, and maintain high-quality code. Here is the
|
|
70
|
-
specific task you need to complete:
|
|
102
|
+
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:
|
|
71
103
|
|
|
72
104
|
<next_task>
|
|
73
105
|
$nexttask
|
|
74
106
|
</next_task>
|
|
75
107
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
1. Analyze the task
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
Do not include any additional commentary or explanations outside of these tagged sections. Your final output should not duplicate or rehash any of the work you did in the task analysis section.
|
|
108
|
+
Please follow these steps to complete the task:
|
|
109
|
+
|
|
110
|
+
1. Analyze the task and plan your approach. In your thinking block, create an implementation plan wrapped in <implementation_plan> tags. Include:
|
|
111
|
+
- A detailed breakdown of the task into clear, actionable steps
|
|
112
|
+
- For each step, identify:
|
|
113
|
+
* Potential challenges and proposed solutions
|
|
114
|
+
* Architectural implications
|
|
115
|
+
* How to adhere to clean code principles
|
|
116
|
+
* Impact on the overall system
|
|
117
|
+
* Defensive programming techniques to employ
|
|
118
|
+
* Potential edge cases and how to handle them
|
|
119
|
+
* A testing strategy for the component
|
|
120
|
+
|
|
121
|
+
2. Execute the necessary changes or Bash commands to complete the task. Use parallel agents for dev work when appropriate to increase efficiency.
|
|
122
|
+
|
|
123
|
+
3. If a linter is defined for this project, run it and include the output in <linter_output> tags.
|
|
124
|
+
|
|
125
|
+
4. Describe the changes you've made in <changes> tags. Include:
|
|
126
|
+
- A summary of implemented changes
|
|
127
|
+
- Explanation of architectural decisions
|
|
128
|
+
- Potential areas of concern or future considerations
|
|
129
|
+
- Confirmation of defensive programming techniques
|
|
130
|
+
- Verification that all failure modes throw exceptions
|
|
131
|
+
- How edge cases were addressed
|
|
132
|
+
- Outline of the testing strategy
|
|
133
|
+
|
|
134
|
+
5. Add any questions for future reference to the QUESTIONS.md file. Summarize these additions in <questions_update> tags.
|
|
135
|
+
|
|
136
|
+
6. Add any ideas for future improvements or features to the IDEAS.md file. Summarize these additions in <ideas_update> tags.
|
|
137
|
+
|
|
138
|
+
Important guidelines:
|
|
139
|
+
|
|
140
|
+
- Simplicity: Delete old code, avoid hoarding. Use git for version control.
|
|
141
|
+
- Brutal honesty: Disagree when needed. If something fails, let it fail visibly.
|
|
142
|
+
- No cheating: Fix failing tests, don't skip them. No mocks without permission.
|
|
143
|
+
- No production fallbacks: Never catch exceptions to return fallback values or silently handle integration failures.
|
|
144
|
+
- Write real integration tests and run linters/tests frequently during development.
|
|
145
|
+
- Stay on the current git branch if it's a feature branch.
|
|
146
|
+
- Set up pre-commit hooks for basic SDLC protections.
|
|
147
|
+
|
|
148
|
+
Your final output should follow this structure:
|
|
149
|
+
|
|
150
|
+
<execution>
|
|
151
|
+
[Details of executed changes or commands]
|
|
152
|
+
</execution>
|
|
153
|
+
|
|
154
|
+
<linter_output>
|
|
155
|
+
[Linter output, if applicable]
|
|
156
|
+
</linter_output>
|
|
157
|
+
|
|
158
|
+
<changes>
|
|
159
|
+
[Description of changes as outlined above]
|
|
160
|
+
</changes>
|
|
161
|
+
|
|
162
|
+
<questions_update>
|
|
163
|
+
[Summary of questions added to QUESTIONS.md]
|
|
164
|
+
</questions_update>
|
|
165
|
+
|
|
166
|
+
<ideas_update>
|
|
167
|
+
[Summary of ideas added to IDEAS.md]
|
|
168
|
+
</ideas_update>
|
|
169
|
+
|
|
170
|
+
Remember to adhere to the project's standards and best practices. Your work will be reviewed before being committed to the repository.
|
|
171
|
+
|
|
172
|
+
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.
|
|
142
173
|
" | tee >(cat > $LOGFILE-developer)
|
|
143
174
|
|
|
144
175
|
echo -e "\033[32m==================================================================\033[0m"
|
|
@@ -163,9 +194,13 @@ Related docs:
|
|
|
163
194
|
|
|
164
195
|
Please review the task and make sure it's complete, and done to satisfaction.
|
|
165
196
|
DO NOT trust the developer's notes, always review the code and build/test results yourself.
|
|
166
|
-
Look for typical 'cheating' patterns
|
|
167
|
-
|
|
168
|
-
|
|
197
|
+
Look for typical 'cheating' patterns:
|
|
198
|
+
- Turning off unit tests or marking them as ignored
|
|
199
|
+
- Taking files out of the compilation configuration
|
|
200
|
+
- Redefining the plan to skip tasks that aren't working
|
|
201
|
+
- Silent exception handlers that return fallback values instead of failing
|
|
202
|
+
- Try/catch blocks that log warnings but continue with empty/default data
|
|
203
|
+
- Any code that catches integration failures and returns mock responses
|
|
169
204
|
|
|
170
205
|
Also note: please avoid switching git branches - stay on the current branch, as
|
|
171
206
|
long as it's a proper feature branch.
|
|
@@ -186,43 +221,69 @@ If you have any ideas for the future, you can add them to IDEAS.md.
|
|
|
186
221
|
|
|
187
222
|
# run the reviewer/tester
|
|
188
223
|
time claude --dangerously-skip-permissions -p "
|
|
189
|
-
You are
|
|
190
|
-
A developer has completed this task: $nexttask
|
|
224
|
+
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.
|
|
191
225
|
|
|
192
|
-
|
|
193
|
-
The static code reviewer reviewed the code and its (possibly partial) result is at $LOGFILE-reviewer .
|
|
226
|
+
Here is the task the developer has completed:
|
|
194
227
|
|
|
195
|
-
|
|
228
|
+
<task_description>
|
|
229
|
+
${nexttask}
|
|
230
|
+
</task_description>
|
|
231
|
+
|
|
232
|
+
To conduct your review, you have access to the following related documents:
|
|
196
233
|
- BRIEF.md
|
|
197
234
|
- docs/PLAN.md
|
|
198
235
|
- docs/QUESTIONS.md
|
|
199
236
|
- docs/CLAUDE-NOTES.md
|
|
200
237
|
- README.md
|
|
201
238
|
|
|
202
|
-
|
|
203
|
-
1. Ensuring ALL code compiles successfully
|
|
204
|
-
2. Running ALL tests and linters
|
|
205
|
-
3. Confirming there are truly no remaining tasks
|
|
239
|
+
The developer's notes are available in a file named ${LOGFILE}-developer.
|
|
206
240
|
|
|
207
|
-
|
|
241
|
+
Instructions for your review process:
|
|
208
242
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
243
|
+
1. Carefully read and understand the task description.
|
|
244
|
+
2. Review the developer's notes, but do not trust them implicitly.
|
|
245
|
+
3. Examine the code and build/test results independently.
|
|
246
|
+
4. Look for common 'cheating' patterns, including but not limited to:
|
|
247
|
+
- Disabling or ignoring unit tests
|
|
248
|
+
- Excluding files from compilation
|
|
249
|
+
- Redefining the plan to skip challenging tasks
|
|
250
|
+
- Using silent exception handlers that return fallback values
|
|
251
|
+
- Implementing try/catch blocks that log warnings but continue with empty/default data
|
|
252
|
+
- Catching integration failures and returning mock responses
|
|
253
|
+
5. Stay on the current git branch, as long as it's a proper feature branch.
|
|
254
|
+
6. If the task is incomplete or unsatisfactory, update docs/PLAN.md with detailed suggestions for the developer to complete the task properly.
|
|
255
|
+
7. If you have questions for future consideration, add them to docs/QUESTIONS.md.
|
|
256
|
+
8. If you have ideas for future improvements, add them to docs/IDEAS.md.
|
|
215
257
|
|
|
216
|
-
|
|
217
|
-
long as it's a proper feature branch.
|
|
258
|
+
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:
|
|
218
259
|
|
|
219
|
-
|
|
220
|
-
the
|
|
260
|
+
1. Summarize the task description in your own words.
|
|
261
|
+
2. List out the key documents you need to review.
|
|
262
|
+
3. For each document, note down relevant quotes or information that pertain to the task.
|
|
263
|
+
4. Explicitly look for any 'cheating' patterns and list any that you find.
|
|
264
|
+
5. Consider arguments for and against the task being complete and of satisfactory quality.
|
|
221
265
|
|
|
222
|
-
|
|
266
|
+
This will ensure a thorough and careful examination of the developer's work. It's OK for this section to be quite long.
|
|
223
267
|
|
|
224
|
-
|
|
225
|
-
|
|
268
|
+
After your analysis, provide a summary of your findings and any necessary actions in the following format:
|
|
269
|
+
|
|
270
|
+
<review_summary>
|
|
271
|
+
Task Status: [Complete/Incomplete]
|
|
272
|
+
Quality Assessment: [Satisfactory/Unsatisfactory]
|
|
273
|
+
|
|
274
|
+
Key Findings:
|
|
275
|
+
1. [Finding 1]
|
|
276
|
+
2. [Finding 2]
|
|
277
|
+
...
|
|
278
|
+
|
|
279
|
+
Actions Taken:
|
|
280
|
+
- [Action 1, e.g., 'Updated PLAN.md with suggestions for improvement']
|
|
281
|
+
- [Action 2, e.g., 'Added question to QUESTIONS.md']
|
|
282
|
+
...
|
|
283
|
+
|
|
284
|
+
</review_summary>
|
|
285
|
+
|
|
286
|
+
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.
|
|
226
287
|
" | tee >(cat > $LOGFILE-tester)
|
|
227
288
|
|
|
228
289
|
# Check if verifier has confirmed all tasks are truly complete
|
|
@@ -233,6 +294,44 @@ If you have any ideas for the future, you can add them to IDEAS.md.
|
|
|
233
294
|
fi
|
|
234
295
|
set -e
|
|
235
296
|
|
|
297
|
+
# Calculate iteration duration and check for failure patterns
|
|
298
|
+
ITERATION_END_TIME=$(date +%s)
|
|
299
|
+
ITERATION_DURATION=$((ITERATION_END_TIME - ITERATION_START_TIME))
|
|
300
|
+
|
|
301
|
+
echo -e "\033[36mIteration $LOOP_COUNTER completed in ${ITERATION_DURATION}s\033[0m"
|
|
302
|
+
|
|
303
|
+
# Check if iteration was suspiciously fast (likely failure mode)
|
|
304
|
+
if [ $ITERATION_DURATION -lt $MIN_ITERATION_TIME ]; then
|
|
305
|
+
CONSECUTIVE_FAST_ITERATIONS=$((CONSECUTIVE_FAST_ITERATIONS + 1))
|
|
306
|
+
echo -e "\033[33mWarning: Fast iteration detected (${ITERATION_DURATION}s < ${MIN_ITERATION_TIME}s threshold)\033[0m"
|
|
307
|
+
echo -e "\033[33mConsecutive fast iterations: $CONSECUTIVE_FAST_ITERATIONS/3\033[0m"
|
|
308
|
+
|
|
309
|
+
# Exit if too many consecutive fast iterations (likely Claude API failure)
|
|
310
|
+
if [ $CONSECUTIVE_FAST_ITERATIONS -ge 3 ]; then
|
|
311
|
+
echo -e "\033[31m==================================================================\033[0m"
|
|
312
|
+
echo -e "\033[31m== FAILURE MODE DETECTED - THROTTLING ACTIVATED\033[0m"
|
|
313
|
+
echo -e "\033[31m==================================================================\033[0m"
|
|
314
|
+
echo -e "\033[31mDetected 3 consecutive iterations under ${MIN_ITERATION_TIME}s each.\033[0m"
|
|
315
|
+
echo -e "\033[31mThis usually indicates Claude API issues (token limits, etc).\033[0m"
|
|
316
|
+
echo -e "\033[31m\033[0m"
|
|
317
|
+
echo -e "\033[31mSuggested actions:\033[0m"
|
|
318
|
+
echo -e "\033[31m- Check your Claude API token limits\033[0m"
|
|
319
|
+
echo -e "\033[31m- Wait a few minutes and restart with: claude-fsd dev\033[0m"
|
|
320
|
+
echo -e "\033[31m- Review logs in: logs/\033[0m"
|
|
321
|
+
echo -e "\033[31m==================================================================\033[0m"
|
|
322
|
+
exit 1
|
|
323
|
+
fi
|
|
324
|
+
|
|
325
|
+
# Add exponential backoff delay for fast iterations
|
|
326
|
+
BACKOFF_DELAY=$((CONSECUTIVE_FAST_ITERATIONS * 60)) # 1min, 2min, 3min
|
|
327
|
+
echo -e "\033[33mApplying backoff delay: ${BACKOFF_DELAY}s\033[0m"
|
|
328
|
+
sleep $BACKOFF_DELAY
|
|
329
|
+
else
|
|
330
|
+
# Reset counter on successful iteration
|
|
331
|
+
CONSECUTIVE_FAST_ITERATIONS=0
|
|
332
|
+
echo -e "\033[32mNormal iteration timing - continuing...\033[0m"
|
|
333
|
+
fi
|
|
334
|
+
|
|
236
335
|
sleep 1
|
|
237
336
|
done
|
|
238
337
|
|