Self-healing debug agent powered by Claude Code CLI
Project description
DaveLoop
The agent that doesn't quit until the job is done.
DaveLoop is a self-healing autonomous agent powered by LLM-driven iterative reasoning. It was designed for debugging. Then it started building features, writing test suites, fixing production workflows, and improving its own source code -- all without being asked.
You give it a problem. It reasons, hypothesizes, executes, verifies, and loops until the problem is gone. No hand-holding. No copy-pasting context between retries. No pressing "approve" every 10 seconds. It just works.
pip install daveloop
What DaveLoop Has Actually Done
This isn't a toy demo. These are real, logged, verifiable results from DaveLoop running autonomously.
It Upgraded Itself
DaveLoop was given a feature request file and told to add capabilities to its own codebase. It read its own source code, understood the architecture, and implemented 4 major features:
- TaskQueue -- multi-bug sequential processing with status tracking
- Session Memory -- persistent history across runs via
.daveloop_history.json - InputMonitor -- real-time interrupt system (type
waitmid-execution to redirect it) - Multi-task CLI -- queue multiple bugs in one command
It verified the syntax, tested the integration, and resolved. One session. Its own codebase. No guidance.
It Built a Complete Mobile Test Suite From Scratch
Pointed at an Android Dog Dating app on an emulator, DaveLoop:
- Located and installed the APK autonomously
- Dumped the UI hierarchy with
uiautomatorto understand the screen layout - Read the Kotlin source files to understand data models and navigation
- Discovered the Room DB seeds 10 mock dog profiles on fresh install
- Wrote 3 comprehensive Maestro YAML test flows:
- Swipe card functionality (left/right swipe with profile progression)
- Matches vs Chat screen separation (distinct bottom nav destinations)
- Chat recipient verification (message send and display)
- Ran all tests 3 consecutive times -- all passed
One iteration. Zero human input. From APK to passing test suite.
It Debugged a Production n8n Workflow
A WhatsApp webhook integration was returning 500 errors on every request. Hebrew and English messages both failing. DaveLoop:
- Traced the data flow through the entire n8n workflow JSON
- Found Bug #1: incorrect nested path
webhookData.data.messagesinstead ofwebhookData.data.messages.message - Found Bug #2: the
If2node was reading from MongoDB output ($json.body) instead of referencing the webhook node directly - Fixed both, preserving the Hebrew goodbye detection logic that was actually correct
- Generated a test script and deployment guide
Two bugs, both data structure traversal errors buried in a multi-node workflow. Found and fixed.
It Solved a Django ORM Bug in One Iteration
Running against SWE-bench, DaveLoop resolved django__django-13321 -- a real bug from the Django issue tracker -- in a single iteration. 5 minutes from start to [DAVELOOP:RESOLVED].
{
"instance_id": "django__django-13321",
"repo": "django/django",
"resolved": true,
"iterations": 1
}
It Fixed a Bug in tqdm (47k+ GitHub Stars)
A ZeroDivisionError when total=0. DaveLoop explored the entire tqdm codebase, traced all division operations across multiple files, identified that if total: was treating 0 the same as None, and applied a targeted fix. One iteration.
How It Works
You describe the bug
|
v
DaveLoop injects a reasoning protocol into the LLM
|
v
The agent analyzes: KNOWN / UNKNOWN / HYPOTHESIS / NEXT ACTION
|
v
Executes the fix, runs verification
|
v
Not fixed? Loop again with full context (--continue)
|
v
Fixed? --> [DAVELOOP:RESOLVED]
Stuck? --> [DAVELOOP:BLOCKED] (documents what it tried)
The key insight: even the best coding agents sometimes need multiple attempts for complex bugs. DaveLoop automates that retry loop with persistent context and structured reasoning, so each iteration builds on everything the agent already learned.
The 4-Level Reasoning Protocol
Every iteration, DaveLoop forces the agent to state:
| Level | Purpose |
|---|---|
| KNOWN | What facts have been established so far |
| UNKNOWN | What gaps remain |
| HYPOTHESIS | A testable guess about the root cause |
| NEXT ACTION | The concrete step to test that hypothesis |
This prevents random shotgun debugging. Each iteration's KNOWN section grows. The UNKNOWN list shrinks or shifts focus. You can watch the agent systematically close in on the bug in real time.
Install
pip install daveloop
Zero external dependencies. Python 3.7+ and an LLM CLI agent.
Use It Straight From Chat
After installing, paste the following block into your global agent instructions file (the markdown file your coding agent reads for project instructions). This lets you trigger DaveLoop by just talking naturally in chat -- no terminal switching needed.
Click to expand -- copy this into your global agent instructions file
## DaveLoop - Self-Healing Debug Agent
DaveLoop is a Python wrapper that runs the coding agent in a loop until bugs are resolved. It keeps iterating until the issue is fixed.
### Basic Commands
\`\`\`bash
# Basic usage - describe the bug directly
daveloop "your bug description here"
# Specify working directory
daveloop -d /path/to/project "bug description"
# Set max iterations (default is unlimited until resolved)
daveloop -m 10 "bug description"
# Read bug description from a file
daveloop -f error.txt
# Verbose output for debugging
daveloop -v "bug description"
\`\`\`
### Options
| Flag | Description |
|------|-------------|
| `-h, --help` | Show help message |
| `-f, --file FILE` | Read bug description from file |
| `-d, --dir DIR` | Working directory |
| `-m, --max-iterations N` | Maximum iterations before stopping |
| `-v, --verbose` | Enable verbose output |
### How It Works
1. DaveLoop sends your bug description to the coding agent
2. The agent analyzes, hypothesizes, and attempts fixes
3. Runs verification (build/tests)
4. If not resolved, DaveLoop loops back with updated context
5. Continues until `[DAVELOOP:RESOLVED]` or max iterations reached
### Giving DaveLoop a Command via Chat
When the user says "daveloop this" or "run daveloop" with a task, run:
\`\`\`bash
daveloop "the bug description here"
# Or with a specific project directory:
daveloop -d /path/to/project "the bug description"
\`\`\`
Once that's in your agent instructions file, just say:
daveloop this: "mongodb connection error in the lookup node"
or
run daveloop on the jwt validation bug
The agent picks it up and runs DaveLoop automatically. No special syntax.
Usage
Give it a bug
daveloop "routes/order.ts has a race condition on wallet balance. two concurrent orders overdraw the account"
Give it a file
daveloop --file bug-report.txt
Queue multiple bugs
daveloop "fix the login crash" "fix payment validation" "add dark mode toggle"
Point it at a project
daveloop --dir /path/to/project "the bug description"
Limit iterations
daveloop --max-iterations 10 "fix the bug"
Mobile testing mode (Maestro)
daveloop --maestro "write UI tests for the onboarding flow"
Web testing mode (Playwright)
daveloop --web "test the checkout flow end to end"
Interactive Controls
DaveLoop doesn't lock you out. While it's running, type:
| Command | What happens |
|---|---|
wait / pause |
Stops the current iteration. You type a correction. It resumes with your new context. |
add |
Queue a new bug without stopping the current one |
done |
Graceful exit, saves history |
Ctrl+C |
Kill it |
The wait command is the standout feature. When you see the agent going down the wrong path, type wait, tell it what you know, and it course-corrects with full context preserved.
Three Modes
Standard Mode (default)
Classic iterative debugging. Reads code, makes hypotheses, applies fixes, verifies.
Maestro Mode (--maestro)
Autonomous mobile UI testing. Auto-detects devices/emulators, installs APKs, explores UI hierarchy, writes Maestro YAML test flows, and verifies with 3 consecutive passes.
Web Mode (--web)
Playwright-based web testing. Detects your framework (React, Next.js, Vue, etc.), installs Playwright, starts dev servers, and tests with human-like interactions -- real mouse movements, drags, hovers, not just DOM manipulation.
Session Memory
DaveLoop remembers. It saves a history of past sessions in .daveloop_history.json and loads that context into future runs. If it fixed a similar bug before, it knows.
SWE-bench Integration
Test DaveLoop against real-world bugs from open source projects:
daveloop-swebench --file django_hash_task.json --max-iterations 15
Pre-configured tasks from Django, Pytest, SymPy, and Sklearn included.
Battle-Tested On
| Domain | What it solved |
|---|---|
| Security | Juice-Shop race conditions, NoSQL injection, ReDoS, path traversal |
| Backend | Django ORM bugs, session handling crashes |
| Workflow Automation | n8n webhook failures, MongoDB connection errors, multi-node data flow bugs |
| Testing Frameworks | Pytest AST rewriting issues, Material-UI flaky visual regression tests |
| Libraries | tqdm ZeroDivisionError, SymPy C-code generation |
| Mobile | Android Maestro test suite generation from scratch |
| Self | Added features to its own codebase autonomously |
Writing Good Bug Descriptions
More context = fewer iterations.
Vague (works, but slow):
daveloop "fix the bug"
Specific (fast):
daveloop "RACE CONDITION: routes/order.ts lines 139-148. Balance check at 141 before decrement at 142. Two concurrent $100 orders both pass and overdraw to -$100. Need atomic check+decrement."
Include: bug type, file location, reproduction steps, root cause if known, fix direction if you have one.
Logs
Every session is fully logged:
logs/
20260131_142120_iteration_01.log <- what it tried
20260131_142120_iteration_02.log <- what it tried next
20260131_142120_summary.md <- overview
Every reasoning block, every file read, every edit, every command. Full audit trail.
Why DaveLoop Exists
Some bugs don't fall in one shot. Race conditions. Multi-file refactors. Subtle logic errors buried in nested data structures. Production workflows with 12 interconnected nodes.
DaveLoop wraps your coding agent in a persistence layer -- structured reasoning, iterative context, session memory, and the stubbornness to keep going until the job is done or honestly admit it's stuck.
It started as a debug loop. It turned out to be something more.
License
MIT
Built by Dave Bruzil
pip install daveloop
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file daveloop-1.5.1.tar.gz.
File metadata
- Download URL: daveloop-1.5.1.tar.gz
- Upload date:
- Size: 45.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86c52b9da3d160cc5ada44d8ad8bd459928c4a6282649939b9ea941b36db4314
|
|
| MD5 |
8a7f32662ae8727880884df689b86866
|
|
| BLAKE2b-256 |
af9619cf2777daa5c4627ef93d5047d8f8e50ac92f08c62ca3771bedfa36ff58
|
File details
Details for the file daveloop-1.5.1-py3-none-any.whl.
File metadata
- Download URL: daveloop-1.5.1-py3-none-any.whl
- Upload date:
- Size: 30.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25bbac857848a5f281781b0692b3acff59de8686e520aed164581d43c25230c6
|
|
| MD5 |
39f016f80a06a4d14bb4f1ba569a7b88
|
|
| BLAKE2b-256 |
2acf3bcafe14995fe9a6328216cbdd129cf87a4d80e387e615339d095230ad70
|