daveloop 1.0.0__tar.gz → 1.2.0__tar.gz

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.
@@ -0,0 +1,383 @@
1
+ Metadata-Version: 2.1
2
+ Name: daveloop
3
+ Version: 1.2.0
4
+ Summary: Self-healing debug agent powered by Claude Code CLI
5
+ Home-page: https://github.com/davebruzil/DaveLoop
6
+ Author: Dave Bruzil
7
+ Keywords: debugging ai claude automation agent
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.7
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Debuggers
19
+ Classifier: Topic :: Software Development :: Quality Assurance
20
+ Requires-Python: >=3.7
21
+ Description-Content-Type: text/markdown
22
+
23
+ # DaveLoop
24
+
25
+ ![DaveLoop Banner](https://github.com/user-attachments/assets/c0611446-41f2-4d10-ad0b-bcdde63bcfd3)
26
+
27
+ **DaveLoop** is a Claude CLI based debug agent designed to solve bugs in cases where Claude Code fails to one-shot them.
28
+ It feeds itself bugs iteratively until it resolves them or gets blocked. Each iteration builds on the previous one with
29
+ full context thanks to the `--continue` flag.
30
+
31
+ ---
32
+
33
+ ## How It Works
34
+
35
+ 1. You give it a bug description
36
+ 2. It analyzes, makes a hypothesis, and tries a fix
37
+ 3. If not fixed, it loops again with new context
38
+ 4. Keeps going until it outputs `[DAVELOOP:RESOLVED]`
39
+
40
+ ---
41
+
42
+ ## Why Use It
43
+
44
+ - Claude Code sometimes needs multiple attempts to fix complex bugs
45
+ - Race conditions, subtle logic errors, multi-file refactors
46
+ - You dont want to manually copy-paste context every iteration
47
+ - Autonomous operation means you dont need to press enter for permissions all the time
48
+
49
+ ---
50
+
51
+ ## Key Features
52
+
53
+ - **Persistent Context** - uses `claude --continue` so it remembers everything
54
+ - **Exit Signals** - explicitly tells you when done or blocked
55
+ - **Real-time Streaming** - watch it think and debug live
56
+ - **Pragmatic Exits** - if environment is broken, it documents the fix and exits
57
+ - **4-Level Reasoning** - KNOWN, UNKNOWN, HYPOTHESIS, and WHY
58
+
59
+ ---
60
+
61
+ ## The 4-Level Reasoning Protocol
62
+
63
+ ![Reasoning Example](https://github.com/user-attachments/assets/a1bbd83a-27f2-4543-9d48-ef089b3cbd75)
64
+
65
+ The reasoning protocol forces systematic debugging:
66
+
67
+ 1. **Prevents random changes** - cant just try stuff without stating why
68
+ 2. **Builds knowledge incrementally** - each iterations KNOWN grows
69
+ 3. **Explicit about uncertainty** - UNKNOWN list gets smaller or changes focus
70
+ 4. **Testable hypotheses** - you can verify if the guess matches symptoms
71
+ 5. **Clear action items** - NEXT ACTION is concrete and measurable
72
+
73
+ ---
74
+ ## INSTALL
75
+ ### Via pip
76
+ ```bash
77
+ pip install daveloop
78
+ ```
79
+
80
+ ## How to Use
81
+
82
+ ### Basic Usage
83
+
84
+ ```bash
85
+ python daveloop.py "your bug description here"
86
+ ```
87
+
88
+ **Example:**
89
+ ```bash
90
+ python daveloop.py "routes/order.ts has a race condition on wallet balance. two concurrent orders can overdraw the account"
91
+ ```
92
+
93
+ ---
94
+
95
+ ### From a File
96
+
97
+ If you have a detailed bug report:
98
+
99
+ ```bash
100
+ python daveloop.py --file bug-report.txt
101
+ ```
102
+
103
+ The file should contain the bug description. Can be as detailed as you want - stack traces, error logs, reproduction steps, whatever.
104
+
105
+ ---
106
+
107
+ ### From Claude Code Chat
108
+
109
+ Just talk naturally to Claude Code:
110
+
111
+ ```
112
+ "daveloop this: mongodb connection error in lookup artist node"
113
+ ```
114
+
115
+ Or:
116
+
117
+ ```
118
+ "run daveloop on the jwt validation bug"
119
+ ```
120
+
121
+ Claude Code will automatically run:
122
+
123
+ ```bash
124
+ python daveloop.py "mongodb connection error in lookup artist node"
125
+ ```
126
+
127
+ No special commands needed. Just mention "daveloop" and describe the bug.
128
+
129
+ ---
130
+
131
+ ### With Options
132
+
133
+ ```bash
134
+ # Custom working directory
135
+ python daveloop.py "fix the bug" --dir /path/to/your/project
136
+
137
+ # Limit iterations (default is 20)
138
+ python daveloop.py "fix the bug" --max-iterations 10
139
+
140
+ # All together
141
+ python daveloop.py --file bug.txt --dir ./my-app --max-iterations 15
142
+ ```
143
+
144
+ ---
145
+
146
+ ## If Claude CLI Not Found
147
+
148
+ DaveLoop automatically searches for Claude CLI in common locations. But if you get:
149
+
150
+ ```
151
+ ERROR: Claude CLI not found!
152
+
153
+ Please install Claude Code CLI or set CLAUDE_CLI_PATH environment variable:
154
+ Windows: set CLAUDE_CLI_PATH=C:\path\to\claude.cmd
155
+ Linux/Mac: export CLAUDE_CLI_PATH=/path/to/claude
156
+
157
+ Install from: https://github.com/anthropics/claude-code
158
+ ```
159
+
160
+ ### Option 1: Set Environment Variable (Recommended)
161
+
162
+ Find where Claude CLI is installed:
163
+
164
+ **Windows:**
165
+ ```cmd
166
+ where claude.cmd
167
+ ```
168
+
169
+ **Linux/Mac:**
170
+ ```bash
171
+ which claude
172
+ ```
173
+
174
+ Then set the path:
175
+
176
+ **Windows (temporary - current session):**
177
+ ```cmd
178
+ set CLAUDE_CLI_PATH=C:\Users\YourName\AppData\Roaming\npm\claude.cmd
179
+ ```
180
+
181
+ **Windows (permanent):**
182
+ ```cmd
183
+ setx CLAUDE_CLI_PATH "C:\Users\YourName\AppData\Roaming\npm\claude.cmd"
184
+ ```
185
+
186
+ **Linux/Mac (add to ~/.bashrc or ~/.zshrc):**
187
+ ```bash
188
+ export CLAUDE_CLI_PATH=/usr/local/bin/claude
189
+ ```
190
+
191
+ ---
192
+
193
+ ### Option 2: Add to PATH
194
+
195
+ **Windows:**
196
+ 1. Search for "environment variables" in start menu
197
+ 2. Click "Environment Variables" button
198
+ 3. Under "User variables", find "Path"
199
+ 4. Add the directory containing claude.cmd
200
+ 5. Restart terminal
201
+
202
+ **Linux/Mac:**
203
+ ```bash
204
+ # Add to ~/.bashrc or ~/.zshrc
205
+ export PATH="$PATH:/path/to/claude/directory"
206
+ ```
207
+
208
+ ---
209
+
210
+ ### Option 3: Install/Reinstall Claude CLI
211
+
212
+ If Claude CLI isnt installed:
213
+
214
+ ```bash
215
+ npm install -g @anthropics/claude-code
216
+ ```
217
+
218
+ After setting the path, run DaveLoop again.
219
+
220
+ ---
221
+
222
+ ## What Happens When You Run It
223
+
224
+ 1. **Banner shows up** - you see the DAVELOOP ASCII art
225
+ 2. **Session info** - working dir, max iterations, prompt loaded
226
+ 3. **Bug report** - your description echoed back
227
+ 4. **Iteration 1 starts** - progress bar shows up
228
+ 5. **You see the reasoning** - KNOWN, UNKNOWN, HYPOTHESIS, NEXT ACTION
229
+ 6. **You see the actions** - file reads, edits, bash commands
230
+ 7. **Iteration completes** - either continues or exits
231
+
232
+ ---
233
+
234
+ ## Reading the Output
235
+
236
+ Output is color coded:
237
+
238
+ - **Blue** - reasoning blocks and actions
239
+ - **White** - normal text and code
240
+ - **Dim** - less important details
241
+ - **Green** - success messages
242
+ - **Red** - errors
243
+ - **Yellow** - warnings
244
+
245
+ Key things to watch for:
246
+
247
+ - **Reasoning blocks** - shows how its thinking through the problem
248
+ - **Tool usage** - what files its reading/editing
249
+ - **Exit signals** - `[Exit signal detected: RESOLVED]` means its done
250
+
251
+ ---
252
+
253
+ ## When It Finishes
254
+
255
+ ### Three Possible Outcomes:
256
+
257
+ **1. Success - Bug is Fixed**
258
+
259
+ ★ ★ ★ BUG SUCCESSFULLY RESOLVED ★ ★ ★
260
+
261
+ Bug fixed in 3 iteration(s)!
262
+ ```
263
+
264
+ **2. Blocked - Needs Human Help**
265
+ ```
266
+ ERROR: Claude is blocked - needs human help
267
+ ```
268
+
269
+ Check the logs to see what it tried. Usually means:
270
+ - Environment issues (missing dependencies)
271
+ - Need clarification on requirements
272
+ - Need access to external systems
273
+
274
+ **3. Max Iterations - Ran Out of Attempts**
275
+ ```
276
+ WARNING: Max iterations (20) reached without resolution
277
+ ```
278
+
279
+ Check logs in `logs/` directory. Either:
280
+ - Increase max iterations
281
+ - Provide more context about the bug
282
+ - Manually help it past a blocker
283
+
284
+ ---
285
+
286
+ ## Logs Location
287
+
288
+ Every session creates logs:
289
+
290
+ ```
291
+ logs/
292
+ 20240127_143022_iteration_01.log <- first attempt
293
+ 20240127_143022_iteration_02.log <- second attempt
294
+ 20240127_143022_summary.md <- overview
295
+ ```
296
+
297
+ Session ID format: `YYYYMMDD_HHMMSS`
298
+
299
+ Useful for:
300
+ - Seeing what the agent tried
301
+ - Debugging why it got stuck
302
+ - Understanding its reasoning process
303
+ - Proving to your team that the AI actually fixed the bug
304
+
305
+ ---
306
+
307
+ ## Tips for Good Bug Descriptions
308
+
309
+ **Bad:**
310
+ ```bash
311
+ python daveloop.py "fix the bug"
312
+ ```
313
+ Too vague. What bug? Where?
314
+
315
+ **Better:**
316
+ ```bash
317
+ python daveloop.py "wallet balance goes negative when two users checkout simultaneously"
318
+ ```
319
+ Has symptom and context.
320
+
321
+ **Best:**
322
+ ```bash
323
+ python daveloop.py "RACE CONDITION: routes/order.ts wallet payment (lines 139-148). Balance check at line 141 happens BEFORE decrement
324
+ at line 142. Two concurrent $100 orders both pass the check and overdraw wallet to -$100. Need atomic check+decrement."
325
+ ```
326
+
327
+ Has:
328
+ - Bug type (race condition)
329
+ - Location (file and lines)
330
+ - Reproduction (concurrent orders)
331
+ - Root cause (non-atomic operations)
332
+ - Suggested fix direction (atomic operation)
333
+
334
+ **More context = faster resolution = fewer iterations**
335
+
336
+ ---
337
+
338
+ ## Interrupting the Agent
339
+
340
+ If you need to stop it:
341
+ - Press `Ctrl+C` once - graceful shutdown
342
+ - Press `Ctrl+C` twice - force kill
343
+
344
+ Logs are saved even if interrupted.
345
+
346
+ ---
347
+
348
+ ## Testing Before Production
349
+
350
+ Run on test bugs first:
351
+
352
+ ```bash
353
+ # Simple test
354
+ python daveloop.py "create a file test.txt with 'hello world' and output [DAVELOOP:RESOLVED]"
355
+ ```
356
+
357
+ Should resolve in 1-2 iterations. If it works, youre good to go.
358
+
359
+ ---
360
+
361
+ ## Using with SWE-bench
362
+
363
+ For testing against real-world benchmark bugs:
364
+
365
+ ```bash
366
+ python daveloop_swebench.py --file django_hash_task.json --max-iterations 15
367
+ ```
368
+
369
+ Comes with pre-configured bugs from:
370
+ - Django ORM
371
+ - Pytest AST rewriting
372
+ - SymPy code generation
373
+ - Sklearn edge cases
374
+
375
+ ---
376
+
377
+ ## Tested On
378
+
379
+ - Juice-Shop security vulnerabilities (race conditions, NoSQL injection, ReDoS, path traversal)
380
+ - SWE-bench real-world bugs (Django ORM, Pytest AST, SymPy C-code generation)
381
+ - Production n8n workflow errors (MongoDB connection, webhook failures)
382
+
383
+ **Success rate significantly higher than one-shot attempts because of the iterative + reasoning approach**