# SPDX-License-Identifier: Apache-2.0
# Copyright 2025 SWE Agent Project

# SWE Agent - Project Structure Summary

## Project Overview

**SWE Agent** is a cutting-edge multi-agent Software Engineering system that leverages advanced LangGraph state machines for intelligent code analysis, generation, and workflow optimization. It serves as a headless agentic IDE with comprehensive tool support for software development tasks.

### Key Information
- **Version**: 1.0.26 (PyPI), 1.0.2 (setup.py)
- **Author**: Harish SG (harishsg993010@gmail.com)
- **License**: MIT License
- **Python Requirements**: >=3.9
- **Repository**: https://github.com/harishsg993010/SWE-Agent

## Architecture Overview

### Multi-Agent System
The project implements a sophisticated multi-agent architecture with specialized agents:

1. **Planner Agent** (`swe_agent/agents/planner.py`)
   - Project planning and technical specifications
   - Task breakdown and workflow design

2. **Software Engineer Agent** (`swe_agent/agents/software_engineer.py`)
   - Primary orchestrator and task delegation
   - Workflow coordination between agents

3. **Code Analyzer Agent** (`swe_agent/agents/code_analyzer.py`)
   - Deep code analysis and quality assessment
   - Structure analysis and dependency tracking

4. **Editor Agent** (`swe_agent/agents/editor.py`)
   - File editing and modifications
   - Code generation and refactoring

## Directory Structure

### Core Components

```
swe_agent/                    # Main package directory
├── agents/                   # Multi-agent system implementation
├── cli/                      # Command-line interfaces
├── config/                   # Configuration management
├── language_support/         # Multi-language support
├── prompts/                  # Agent prompts and templates
├── sdk/                      # Software Development Kit
├── state/                    # State management for workflows
├── tools/                    # Comprehensive toolset (24+ tools)
├── utils/                    # Utility functions and helpers
└── workflows/                # LangGraph workflow implementations
```

### Tools Ecosystem (24+ Tools)

Located in `swe_agent/tools/`, the system provides:

- **File Operations**: Create, read, edit, replace, rewrite files
- **Shell Operations**: Execute commands with timeout and error handling
- **Git Operations**: Status, diff, add, commit functionality
- **Code Analysis**: Advanced semantic search, function/class finding
- **Security Scanning**: Vulnerability detection and secret scanning
- **MCP Integration**: Model Context Protocol server management
- **Workspace Management**: Project overview and directory analysis

### Configuration & Rules

- **Rules Directory** (`rules/`): Language-specific coding standards
  - Python, JavaScript, Java, C++, Go, C style guides
  - Best practices and naming conventions
  - Code organization patterns

- **Configuration** (`config/`): System settings and preferences

### User Interfaces

Multiple interface options for different use cases:

1. **Interactive CLI** (`swe_agent/cli/interface.py`)
   - Standard command-line interface
   - Usage: `swe-agent --interactive`

2. **Pair Programming Interface** (`swe_agent/cli/pair_programming_interface.py`)
   - Aider-like collaborative coding
   - Usage: `swe-agent --pair`

3. **Warp Interface** (`swe_agent/cli/warp_interface.py`)
   - Modern terminal-style interface
   - Usage: `swe-agent --warp`

## Key Features

### Universal Language Support
- Works with any programming language through Claude's natural understanding
- Language-specific best practices enforcement
- Intelligent code analysis across multiple languages

### MCP Integration
- Built-in Model Context Protocol support
- DeepWiki server for repository documentation
- Extensible server management system

### Advanced Toolset
- 24+ specialized tools for software engineering tasks
- Intelligent code search and analysis
- Security vulnerability scanning
- Git workflow automation

### State Management
- LangGraph-based workflow orchestration
- Persistent state across agent interactions
- Clean workflow implementations

## Dependencies

### Core Dependencies
- **anthropic**: >=0.57.1 (Claude AI integration)
- **langchain**: >=0.3.26 (LLM framework)
- **langchain-anthropic**: >=0.3.17 (Anthropic integration)
- **langgraph**: >=0.5.3 (Workflow state machines)
- **rich**: >=14.0.0 (Terminal formatting)
- **click**: >=8.0.0 (CLI framework)

### Additional Tools
- **psutil**: System process utilities
- **python-dotenv**: Environment variable management
- **pydantic**: Data validation
- **requests/aiohttp**: HTTP client libraries
- **detect-secrets**: Security scanning
- **whoosh**: Full-text search indexing
- **pygame**: Game development support

## Build & Distribution

### Package Management
- **setup.py**: Traditional setuptools configuration
- **pyproject.toml**: Modern Python packaging (Hatchling backend)
- **MANIFEST.in**: Package inclusion rules

### Build Artifacts
- **build/**: Compiled package artifacts
- **dist/**: Distribution packages
- **swe_ai_agent.egg-info/**: Package metadata

## Development Workflow

### Version Control
- Git repository with comprehensive history
- Automated build and deployment scripts
- Change tracking in `changes/` directory

### Quality Assurance
- Security scanning integration
- Code style enforcement via rules
- Comprehensive testing framework

### Documentation
- SDK examples and scripts
- Deployment guides and instructions
- Runtime fixes and status tracking

## Usage Examples

```bash
# Install from PyPI
pip install swe-ai-agent

# Interactive mode
swe-agent --interactive

# Pair programming interface
swe-agent --pair

# Modern terminal interface
swe-agent --warp

# Execute specific task
swe-agent --task "create a calculator in Python"
```

## Recent Development Activity

Based on the changes directory, recent work includes:
- Warp interface enhancements and diff functionality
- Security scanner improvements
- S3 integration implementation
- Fibonacci project examples
- Runtime fixes and optimizations

## Environment Requirements

- **Python**: 3.9+ (supports 3.9, 3.10, 3.11, 3.12)
- **API Key**: Anthropic API key required (ANTHROPIC_API_KEY environment variable)
- **Operating System**: Cross-platform (OS Independent)

## Project Status

- **Development Status**: Production/Stable (5 - Production/Stable)
- **Intended Audience**: Developers
- **Topic**: Software Development Build Tools
- **Active Development**: Yes (based on recent commits and changes)

This project represents a sophisticated approach to AI-assisted software engineering, combining multiple specialized agents with comprehensive tooling to create a powerful development environment.