Skip to content

JoseRFJuniorLLMs/EVA-Code-Brain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EVA-Code-Brain 🧠

Intelligent Code Analysis & RAG System with Neo4j Graph Memory

EVA-Code-Brain is an advanced code intelligence system that combines vector embeddings, graph-based memory, and AI agents to provide deep code understanding, quality analysis, and intelligent search capabilities.


🌟 Features

Core Capabilities

  • 🔍 Semantic Code Search - Find code by meaning, not just keywords
  • 📊 Code Quality Analysis - Automated quality scoring and recommendations
  • 🧪 Test Generation - AI-powered unit test creation
  • 📈 Health Analytics - Codebase health metrics and trends
  • 🔄 Git Integration - Automatic indexing on commits
  • 🤖 Multi-Agent System - Specialized AI agents for different tasks

AI Models Supported

  • Ollama (Local) - nomic-embed-text, llama3
  • OpenAI - GPT-4, text-embedding-ada-002
  • Anthropic - Claude 3.5 Sonnet

Database Stack

  • PostgreSQL - Primary data storage with pgvector
  • Neo4j - Graph-based code relationships
  • Vector Search - Semantic similarity search

🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│                     EVA-Code-Brain                          │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐     │
│  │   Indexer    │  │    Search    │  │   Agents     │     │
│  │              │  │              │  │              │     │
│  │ • Chunking   │  │ • Semantic   │  │ • Quality    │     │
│  │ • Embedding  │  │ • Reranking  │  │ • Testing    │     │
│  │ • Neo4j      │  │ • Hybrid     │  │ • Git        │     │
│  └──────────────┘  └──────────────┘  └──────────────┘     │
│                                                             │
├─────────────────────────────────────────────────────────────┤
│                     Storage Layer                           │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐     │
│  │  PostgreSQL  │  │    Neo4j     │  │   Ollama     │     │
│  │              │  │              │  │              │     │
│  │ • Vectors    │  │ • Graph      │  │ • Local LLM  │     │
│  │ • Metadata   │  │ • Relations  │  │ • Embeddings │     │
│  └──────────────┘  └──────────────┘  └──────────────┘     │
│                                                             │
└─────────────────────────────────────────────────────────────┘

📁 Project Structure

EVA-Code-Brain/
├── cmd/                      # Command-line tools
│   └── eva-code-brain/       # Main application
├── internal/                 # Internal packages
│   ├── agents/               # AI agent implementations
│   ├── chunker/              # Code chunking logic
│   ├── graph/                # Neo4j client
│   ├── indexer/              # Code indexing
│   ├── llm/                  # LLM clients (Ollama, OpenAI, Anthropic)
│   ├── memory/               # Memory management
│   ├── quality/              # Code quality analysis
│   ├── search/               # Search & reranking
│   └── tools/                # Agent tools
├── migrations/               # Database migrations
│   ├── schema.sql            # Initial schema
│   ├── v2_migration.sql      # Version 2
│   └── ...                   # Incremental migrations
├── scripts/                  # Utility scripts
│   ├── deploy.sh             # Deployment script
│   ├── index_all.sh          # Bulk indexing
│   ├── migrate.sh            # Run migrations
│   └── setup.sh              # Initial setup
├── web/                      # Web interface
│   └── index.html            # Search UI
├── .env                      # Environment variables
├── go.mod                    # Go dependencies
└── README.md                 # This file

🚀 Quick Start

Prerequisites

  • Go 1.21+
  • PostgreSQL 14+ with pgvector extension
  • Neo4j 5.0+
  • Ollama (optional, for local models)

Installation

# 1. Clone repository
git clone https://github.com/JoseRFJuniorLLMs/EVA-Code-Brain.git
cd EVA-Code-Brain

# 2. Install dependencies
go mod download

# 3. Setup environment
cp .env.example .env
# Edit .env with your configuration

# 4. Run setup script
chmod +x scripts/setup.sh
./scripts/setup.sh

# 5. Run migrations
chmod +x scripts/migrate.sh
./scripts/migrate.sh

# 6. Build
go build -o eva-code-brain main.go

# 7. Run
./eva-code-brain

Docker Setup (Alternative)

# Start all services
docker-compose up -d

# Run migrations
docker-compose exec app ./scripts/migrate.sh

# View logs
docker-compose logs -f app

⚙️ Configuration

Environment Variables

# Database
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=your_password
DB_NAME=eva_code_brain

# Neo4j
NEO4J_URI=bolt://localhost:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=your_password

# Ollama (Local)
OLLAMA_HOST=http://localhost:11434
OLLAMA_EMBEDDING_MODEL=nomic-embed-text
OLLAMA_CHAT_MODEL=llama3

# OpenAI (Optional)
OPENAI_API_KEY=sk-...

# Anthropic (Optional)
ANTHROPIC_API_KEY=sk-ant-...

# Server
PORT=8080
LOG_LEVEL=info

📖 Usage

Index a Codebase

# Index current directory
./eva-code-brain index .

# Index specific directory
./eva-code-brain index /path/to/code

# Index with custom chunk size
./eva-code-brain index . --chunk-size 1000

Search Code

# Semantic search
./eva-code-brain search "how to authenticate users"

# Search with filters
./eva-code-brain search "database query" --language go --limit 10

Code Quality Analysis

# Analyze file
./eva-code-brain quality analyze main.go

# Analyze directory
./eva-code-brain quality analyze ./internal

# Generate report
./eva-code-brain quality report --output report.html

Generate Tests

# Generate tests for file
./eva-code-brain test generate main.go

# Generate tests for package
./eva-code-brain test generate ./internal/agents

Web Interface

# Start web server
./eva-code-brain serve

# Access at http://localhost:8080

🔧 API Endpoints

Search

POST /api/search
{
  "query": "authentication logic",
  "limit": 10,
  "language": "go"
}

Index

POST /api/index
{
  "path": "/path/to/code",
  "recursive": true
}

Quality

GET /api/quality/{file_path}

Health

GET /api/health

🧪 Testing

# Run all tests
go test ./...

# Run with coverage
go test -cover ./...

# Run specific package
go test ./internal/search

# Benchmark
go test -bench=. ./internal/chunker

📊 Performance

Benchmarks

Operation Time Memory
Chunk 1000 LOC ~50ms ~5MB
Embed 100 chunks ~200ms ~10MB
Search (semantic) ~30ms ~2MB
Neo4j query ~10ms ~1MB

Scalability

  • Indexed Files: 100K+ files
  • Code Chunks: 1M+ chunks
  • Search Latency: < 100ms (p95)
  • Concurrent Users: 100+

🛠️ Development

Project Guidelines

  • Code Style: gofmt + golint
  • Testing: Minimum 70% coverage
  • Documentation: GoDoc comments
  • Commits: Conventional Commits

Adding a New Feature

  1. Create feature branch: git checkout -b feature/my-feature
  2. Implement with tests
  3. Run quality checks: go test ./... && golint ./...
  4. Commit: git commit -m "feat: add my feature"
  5. Push and create PR

Database Migrations

# Create new migration
./scripts/create_migration.sh "add_new_table"

# Run migrations
./scripts/migrate.sh

# Rollback
./scripts/migrate.sh down

🤝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Submit a pull request

See CONTRIBUTING.md for details.


📝 License

MIT License - see LICENSE file for details.


🙏 Acknowledgments

  • Ollama - Local LLM infrastructure
  • Neo4j - Graph database
  • pgvector - PostgreSQL vector extension
  • OpenAI - GPT models
  • Anthropic - Claude models

📞 Support


🗺️ Roadmap

  • Multi-language support (Python, JavaScript, Java)
  • Real-time code analysis
  • IDE plugins (VSCode, IntelliJ)
  • Cloud deployment templates
  • Advanced visualization dashboard
  • Code refactoring suggestions
  • Security vulnerability detection

Made with ❤️ by the EVA-IA Team

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published