Skip to main content

SWEDeepDiver is an automated analysis agent for Software Engineering (SWE) problems.

Project description

SWEDeepDiver

SWEDeepDiver is an automated analysis agent for Software Engineering (SWE) problems, designed to perform deep diagnosis and root cause analysis for multi-technology stack issues including Android, iOS, Backend, and Frontend.

It simulates experienced engineers' troubleshooting habits: from whole to part, from symptoms to root causes, comprehensively utilizing logs, exception traces, various issue files, source code, and knowledge bases to build "timeline + evidence chains", ultimately providing structured, verifiable diagnostic conclusions.

PyPI version Python

โœจ Features

Core Capabilities

  • ๐Ÿค– Automated Problem Diagnosis: Simulates experienced engineers' troubleshooting approach using ReAct (Reasoning + Acting) architecture
  • ๐Ÿ” Multi-source Evidence Analysis: Correlates logs, exception traces, issue files, source code, and knowledge bases
  • ๐Ÿ“Š Structured Reasoning: Builds verifiable "timeline + evidence chain" for root cause analysis
  • ๐ŸŽฏ Multi-technology Stack: Supports Android, iOS, backend (Java, Python, Node.js, etc.), and frontend
  • ๐Ÿ’พ Zero-intrusion Design: All state saved in ~/.deepdiver/, no files written to user projects
  • ๐Ÿ”‘ Session Management: Independent sessions, fully traceable and reproducible
  • ๐Ÿ”Œ Plugin System: Custom desensitization, decryption, and filtering strategies
  • ๐Ÿ“š Knowledge Base Integration: Domain-specific knowledge injection for better accuracy
  • ๐ŸŒ Multi-LLM Support: DeepSeek, Moonshot, Alibaba Tongyi, OpenRouter, and more

๐ŸŽ‰ New in v0.2.0

Modern UI & Real-time Feedback

  • ๐Ÿ–ฅ๏ธ Rich Terminal UI: Beautiful, informative terminal interface powered by Rich library
  • ๐Ÿ“Š Real-time Progress Tracking: Watch the agent think, explore, and analyze in real-time
  • ๐Ÿ’ก Key Finding Highlights: Important discoveries are highlighted as they happen
  • ๐ŸŽ›๏ธ Dual Display Modes:
    • Concise Mode: Clean output with just the essentials
    • Verbose Mode: Detailed thinking process and tool outputs
    • Press v during runtime to toggle between modes
  • ๐Ÿ› ๏ธ Smart Tool Display: Tool calls show only key parameters for clarity

Enhanced Reporting

  • ๐Ÿ“„ Interactive HTML Reports: Professional reports with collapsible sections and mobile-responsive design
  • ๐Ÿ“‘ Structured Output Formats: JSON for machine processing, Markdown for documentation, HTML for presentation
  • ๐Ÿ“ˆ Enhanced Metadata: Includes commit counts, review results, and confidence scores

Improved Analysis Tools

  • โฑ๏ธ Time-Range Filtering: Filter logs by time windows for focused analysis
  • ๐Ÿ”Ž Better Grep Results: Shows total/returned line counts with truncation warnings
  • ๐Ÿ“– Enhanced Read Tool: File size and line count information for better context
  • ๐Ÿงช Improved Review Process: Better separation between LLM summaries and user-facing details

Installation

Using uv (Recommended)

uv is a fast Python package installer and resolver written in Rust. It's the recommended way to install SWEDeepDiver:

# Install uv if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install SWEDeepDiver using uv tool
uv tool install deepdiver-cli

Using pip (Alternative)

pip install deepdiver-cli

Additional Requirements

SWEDeepDiver requires ripgrep for efficient file searching:

# On macOS
brew install ripgrep

# On Ubuntu/Debian
sudo apt-get install ripgrep

# Other platforms: refer to ripgrep installation guide

For code analysis functionality, Claude Code CLI is optional:

npm install -g @anthropic-ai/claude-code

Quick Start

Basic Usage

# Analyze issue with code directory (current directory as code)
cd /path/to/your/code
deepdiver -c --attachment_path /path/to/issue/attachments --issue "Application crashes on startup"

# Analyze issue from attachment directory
cd /path/to/issue/attachments
deepdiver --code_path /path/to/your/code --issue "Performance degradation in payment service"

# Analyze attachments only (no code)
cd /path/to/issue/attachments
deepdiver --issue "Database connection timeout errors"

UI Interaction

During analysis, SWEDeepDiver provides real-time feedback:

Step 1: Thinking...
๐Ÿ’ก Key Finding: Exception trace indicates database connection timeout

Step 1: Grep(/var/log/app.log, "Connection timeout")
โŽฟ Grep found 15 result(s)

Step 2: Inspect(/var/log/app.log)
โŽฟ Inspected /var/log/app.log

[Press 'v' to toggle verbose/concise mode]

Press v anytime during analysis to toggle between:

  • Concise Mode (default): Clean output with tool summaries
  • Verbose Mode: Full thinking process and detailed tool outputs

Parameter Reference

  • -c, --code: Declare current working directory as code directory
  • --code-path <PATH>: Additional code directories (multiple allowed)
  • --attachment-path <PATH>: Attachment directories (multiple allowed)
  • --issue "<TEXT>": Problem description in natural language
  • --verbose: Start in verbose mode (show detailed thinking and tool outputs)
  • --list-sessions: List historical diagnosis sessions
  • --show-report <session_id>: Show diagnostic report for specific session

Configuration

Agent Configuration

Configuration files are automatically created on first run. The first time you run DeepDiver, it will automatically generate configuration files from templates:

# Configuration files are auto-created in ~/.deepdiver/config/
# - config.toml: Main configuration (LLM providers, API keys, model settings)
# - knowledge_config.toml: Knowledge base configuration (optional)

To manually configure or update settings:

# Edit the main configuration
# Configure LLM providers, API keys, model settings, etc.
vim ~/.deepdiver/config/config.toml

Plugin Development

Implement custom plugins for data processing:

# Example: Custom data masking
from deepdiver_cli.plugins.datamask import DataMasker

class MyDataMasker(DataMasker):
    def mask(self, raw: str) -> str:
        # Implement your data masking logic
        return masked

The plugin system automatically discovers and loads classes implementing Protocol interfaces.

Usage Example

Analyzing an Android ANR issue:

deepdiver -c --attachment_path examples/android/anr --issue "Application experiences ANR, please analyze the cause"

SWEDeepDiver will:

  1. Parse problem description and attachments
  2. Identify problem type and evidence sources
  3. Call analysis tools (Glob, ProcessFile, Grep, Inspect, AnalyzeCode, etc.)
  4. Build timeline and evidence chains
  5. Generate structured diagnostic report (Markdown + JSON + HTML)
  6. Save all results in ~/.deepdiver/sessions/<session_id>/

Report Output:

  • summary.md: Executive summary with core conclusions and timeline
  • report.json: Complete structured data for further processing
  • report.html: Interactive HTML report with collapsible sections
  • diagnosis_*.md: Detailed diagnosis files with evidence chains

Output Example

**Conclusion**: ANR root cause is `HeavyService.performHeavyOperation` calling `Thread.sleep` in main thread.

**Confidence**: High

**Evidence Strength**: High

**Core Evidence**:
1. **Log/Trace Evidence**:
   - `03:34:05.428` MainActivity: "Performing heavy database operation"
   - `03:34:11.428` ActivityManager reports ANR for service `com.example.testapp/.HeavyService`
   - ANR Trace shows main thread Sleeping at `Thread.sleep`, called by `HeavyService.performHeavyOperation`

**Timeline**:
| Time           | Event                                       | Source              |
|----------------|---------------------------------------------|---------------------|
| 03:34:05.428   | Heavy operation starts                      | MainActivity log    |
| 03:34:11.428   | ANR reported                                | ActivityManager log |
| 03:34:11       | Main thread blocked in sleep                | ANR Trace           |

Project Structure

SWEDeepDiver/
โ”œโ”€โ”€ src/deepdiver_cli/          # Source code
โ”‚   โ”œโ”€โ”€ react_core/             # ReAct core engine (agent, llm, tool)
โ”‚   โ”œโ”€โ”€ tools/                  # Analysis tools (grep, glob, read, inspect, etc.)
โ”‚   โ”œโ”€โ”€ events/                 # Event-driven architecture (NEW)
โ”‚   โ”œโ”€โ”€ ui/                     # UI rendering system (NEW)
โ”‚   โ”œโ”€โ”€ app/                    # Application logic
โ”‚   โ”œโ”€โ”€ chat/                   # Chat models and providers
โ”‚   โ”œโ”€โ”€ plugins/                # Plugin interfaces (datamask, decryptor, filter)
โ”‚   โ”œโ”€โ”€ templates/              # Report templates (HTML, Markdown)
โ”‚   โ”œโ”€โ”€ config.py              # Configuration management
โ”‚   โ””โ”€โ”€ cli.py                 # CLI entry point
โ”œโ”€โ”€ examples/                   # Example issues
โ”œโ”€โ”€ config/                     # Configuration templates
โ”œโ”€โ”€ knowledge/                  # Knowledge base directory
โ”œโ”€โ”€ pyproject.toml             # Python project configuration
โ”œโ”€โ”€ README.md                  # This file
โ””โ”€โ”€ CLAUDE.md                  # Development guide

Technology Stack

  • Python 3.12+ - Primary language
  • Typer - Modern CLI framework
  • Pydantic - Data validation and settings management
  • Rich - Terminal UI and formatting
  • OpenAI - LLM API client
  • HTTPX - Async HTTP client
  • Tenacity - Retry library with exponential backoff
  • Structlog - Structured logging
  • ReAct Pattern - Reasoning + Acting architecture for agent decision-making
  • Event-Driven Architecture - Decoupled UI and business logic (NEW)
  • ripgrep - Fast text search for log analysis

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

Development Setup

git clone https://github.com/SteveYang92/SWEDeepDiver.git
cd SWEDeepDiver
uv venv --python 3.12
source .venv/bin/activate  # Unix/macOS
uv pip install -e ".[dev]"
uv run pytest tests/ -v

License

MIT License - see LICENSE file.

Disclaimer

Security & Privacy

  • SWEDeepDiver is designed for local/self-hosted use
  • Logs, traces, and source code may contain sensitive information
  • Implement proper data masking/decryption plugins for your security requirements
  • API keys and configurations should be kept secure

Diagnostic Limitations

  • Results depend on available data, knowledge bases, and LLM capabilities
  • Not guaranteed to be completely accurate in all scenarios
  • Use as an auxiliary analysis tool, not the sole basis for decisions

Usage Responsibility

  • Provided "as-is" without warranties
  • Test thoroughly in controlled environments before production use

Acknowledgments


For Chinese documentation, see README_CN.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepdiver_cli-0.2.4.tar.gz (135.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deepdiver_cli-0.2.4-py3-none-any.whl (170.8 kB view details)

Uploaded Python 3

File details

Details for the file deepdiver_cli-0.2.4.tar.gz.

File metadata

  • Download URL: deepdiver_cli-0.2.4.tar.gz
  • Upload date:
  • Size: 135.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for deepdiver_cli-0.2.4.tar.gz
Algorithm Hash digest
SHA256 67f33ea0dd027eb76552e3647e0692ccee8f45ac14c57c25e604f633470ac82d
MD5 7d7c6f5e83458170a86e342202d00ea3
BLAKE2b-256 8501b69effa27563d5180257164769bd1537fc55b0ec80a1aa024b77dea15aac

See more details on using hashes here.

File details

Details for the file deepdiver_cli-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: deepdiver_cli-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 170.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for deepdiver_cli-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ffd87249a55ec088492815c0cfccde42a681f46a111da4238b2e22f2f88ce5e5
MD5 871225ea0de07ba52ec77d12ca0f70d9
BLAKE2b-256 49a0ad1c5c991695c3b255a2fbede7724bff7524c267c2a1861d2fdb97141de8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page