# Complete Agent Integration: Prometheus + Every Code + Dexto

## Overview

Integration of three major AI agent platforms into Claude Code CLI:

1. **Prometheus** (Python/LangGraph) - Multi-agent code reasoning with knowledge graphs
2. **Every Code** (Rust/Codex) - Fast terminal-based coding agent with Auto Drive
3. **Dexto** (TypeScript) - Agent harness/orchestration layer with MCP support

## Architecture Comparison

| Aspect | Prometheus | Every Code | Dexto |
|--------|-----------|------------|-------|
| **Language** | Python | Rust | TypeScript |
| **Framework** | LangGraph | Custom event-driven | Agent Harness |
| **Core Role** | Code reasoning & bug fixing | Fast coding execution | Agent orchestration |
| **Key Features** | Knowledge graphs (Neo4j), AST parsing, Docker | Auto Drive, Browser, Multi-agent | Session management, MCP, Tools |
| **Agent Types** | Classification, Bug Reproduction, Context, Patch | Plan, Code, Solve, Auto Review | Custom agents via YAML |
| **Code Understanding** | Neo4j + Tree-sitter AST | Native file system | Plugin-based |
| **Execution** | Docker containers | Native shell | Tool orchestration |
| **LLM Support** | OpenAI, Anthropic, Gemini | ChatGPT, Claude, Gemini | Any (via config) |
| **MCP Support** | ❌ Native | ✅ Native | ✅ Native (client & server) |

## Unified Integration Architecture

```
┌─────────────────────────────────────────────────────────────────────────┐
│                            Claude Code CLI                              │
│  ┌────────────────────────────────────────────────────────────────────┐ │
│  │                      Unified Agent Skills                          │ │
│  │  /agent-plan     /agent-fix-bug    /agent-solve                   │ │
│  │  /agent-context  /agent-review     /agent-orchestrate              │ │
│  └─────────────────────────────────┬──────────────────────────────────┘ │
│                                  │ MCP Client                           │
└──────────────────────────────────┼──────────────────────────────────────┘
                                   │
┌──────────────────────────────────┼──────────────────────────────────────┐
│                    Unified Agent MCP Server                             │
│  ┌────────────────────────────────────────────────────────────────────┐ │
│  │                    Intelligent Router                               │ │
│  │          Routes to best backend for each task                     │ │
│  └─────┬────────────────┬────────────────┬────────────────────────────┘ │
│        │                │                │                               │
│  ┌─────▼─────┐   ┌─────▼─────┐   ┌─────▼─────┐                        │
│  │ Prometheus │   │Every Code │   │  Dexto    │                        │
│  │            │   │           │   │           │                        │
│  │ • KG       │   │ • Auto    │   │ • Harness  │                        │
│  │ • AST      │   │   Drive   │   │ • MCP     │                        │
│  │ • Docker   │   │ • Browser │   │ • Tools   │                        │
│  │ • LangGraph│   │ • Multi   │   │ • Session │                        │
│  │            │   │   Agent   │   │ • YAML    │                        │
│  └───────────┘   └───────────┘   └───────────┘                        │
└─────────────────────────────────────────────────────────────────────────┘
```

## Backend Specialization

### Prometheus - Deep Code Understanding
**Best for:**
- Complex bug fixing with reproduction
- Semantic code search via AST
- Large codebase understanding
- Regression testing
- Documentation analysis

**Unique Capabilities:**
- Neo4j knowledge graph with code relationships
- Tree-sitter AST parsing for precise code analysis
- Docker containerized testing
- LangGraph state machine orchestration

### Every Code - Fast Execution
**Best for:**
- Rapid code generation
- Auto Drive multi-agent tasks
- Browser automation
- Quick iterations
- Terminal-based workflows

**Unique Capabilities:**
- Native Rust performance
- Auto Review background quality checks
- Browser CDP integration
- Multi-CLI orchestration (Claude, Gemini, etc.)

### Dexto - Agent Orchestration
**Best for:**
- Complex multi-step workflows
- Session management
- Tool composition
- Custom agent creation
- MCP client/server operations

**Unique Capabilities:**
- YAML-based agent configuration
- Built-in session management
- Native MCP support (client & server)
- Tool orchestration and composition
- Memory and context management

## MCP Tool Specification

### Core Tools (Available from all backends)

| Tool | Description | Backend Priority |
|------|-------------|------------------|
| `agent_find_file` | Find files by pattern | All |
| `agent_search_code` | Search code by text | Prometheus (AST) > Dexto > Every Code |
| `agent_read_file` | Read file with context | All |
| `agent_create_file` | Create new file | All |
| `agent_edit_file` | Edit existing file | All |
| `agent_run_command` | Execute shell command | Every Code > Dexto > Prometheus (Docker) |

### Prometheus-Exclusive Tools

| Tool | Description |
|------|-------------|
| `prometheus_classify_issue` | Classify GitHub issues (bug/feature/question/doc) |
| `prometheus_fix_bug` | End-to-end bug fixing with reproduction |
| `prometheus_get_context` | Semantic code context from knowledge graph |
| `prometheus_search_ast` | Search by AST node type (function/class/variable) |
| `prometheus_search_docs` | Search documentation with context |
| `prometheus_run_tests` | Run tests in Docker container |
| `prometheus_verify_patch` | Verify patch with regression tests |
| `prometheus_get_callers` | Find all callers of a function |
| `prometheus_get_callees` | Find all functions called by a function |

### Every Code-Exclusive Tools

| Tool | Description |
|------|-------------|
| `everycode_auto_drive` | Orchestrate multi-agent automation |
| `everycode_plan` | Generate implementation plan |
| `everycode_solve` | Coordinate multiple CLI agents |
| `everycode_auto_review` | Background code review |
| `everycode_browser_goto` | Navigate browser to URL |
| `everycode_browser_click` | Click element in browser |
| `everycode_browser_screenshot` | Capture browser screenshot |
| `everycode_browser_type` | Type text in browser |
| `everycode_theme_set` | Set UI theme |

### Dexto-Exclusive Tools

| Tool | Description |
|------|-------------|
| `dexto_create_agent` | Create custom agent from YAML |
| `dexto_run_agent` | Run configured agent |
| `dexto_list_sessions` | List all agent sessions |
| `dexto_resume_session` | Resume previous session |
| `dexto_mcp_connect` | Connect to MCP server |
| `dexto_mcp_list_tools` | List available MCP tools |
| `dexto_orchestrate` | Orchestrate multi-agent workflow |
| `dexto_compose_tools` | Compose multiple tools into workflow |
| `dexto_memory_store` | Store information in agent memory |
| `dexto_memory_retrieve` | Retrieve from agent memory |

## Claude Code Skills

### Primary Skills

```
.claude/skills/agents/
├── plan.md              - Generate implementation plans
├── fix-bug.md           - Fix bugs end-to-end
├── solve.md             - Solve complex problems
├── review.md            - Review code
├── context.md           - Get code context
├── implement.md         - Implement features
├── orchestrate.md       - Orchestrate multi-agent workflows
├── test.md              - Run and analyze tests
└── README.md            - Complete documentation
```

### Skill Backend Selection

| Skill | Primary | Secondary | Enhancement |
|-------|---------|-----------|-------------|
| `/agent-plan` | Every Code | Dexto | Prometheus (context) |
| `/agent-fix-bug` | Prometheus | Dexto | Every Code (review) |
| `/agent-solve` | Every Code | Dexto | Prometheus (analysis) |
| `/agent-review` | Every Code | Dexto | Prometheus (AST) |
| `/agent-context` | Prometheus | Dexto | - |
| `/agent-implement` | Every Code | Dexto | Prometheus (validation) |
| `/agent-orchestrate` | Dexto | Every Code | Prometheus |
| `/agent-test` | Prometheus | Dexto | Every Code |

## Installation Guide

### Prerequisites

```bash
# System requirements
- Python 3.11+
- Rust + Cargo
- Node.js 20+
- TypeScript
- Docker + Docker Compose
- Neo4j (for Prometheus knowledge graph)

# Clone repositories
git clone https://github.com/EuniAI/Prometheus.git ~/Prometheus
git clone https://github.com/just-every/code.git ~/EveryCode
git clone https://github.com/truffle-ai/dexto.git ~/Dexto
```

### Prometheus Setup

```bash
cd ~/Prometheus
pip install -r requirements.txt
cp example.env .env
# Edit .env with API keys (OpenAI, Anthropic, or Gemini)

# Start Neo4j
docker-compose up -d neo4j

# Build knowledge graph for your repo
python -m prometheus.script.build_kg --repo_path /path/to/repo
```

### Every Code Setup

```bash
cd ~/EveryCode
npm install -g @just-every/code

# Authenticate
code
# Choose "Sign in with ChatGPT" or set OPENAI_API_KEY

# Test installation
code --version
```

### Dexto Setup

```bash
cd ~/Dexto
npm install
npm run build

# Configure
cp config.example.yaml config.yaml
# Edit config.yaml with your settings

# Test
npm run start
```

### Unified MCP Server Installation

```bash
# Install all three MCP servers
pip install git+https://github.com/your-org/prometheus-mcp.git
pip install git+https://github.com/your-org/everycode-mcp.git
npm install -g @your-org/dexto-mcp

# Configure Claude Code
# Add to ~/.config/claude-code/config.json:
{
  "mcpServers": {
    "prometheus": {
      "command": "prometheus-mcp",
      "args": ["--repo", "/path/to/your/repo"],
      "env": {
        "OPENAI_API_KEY": "sk-...",
        "NEO4J_URI": "bolt://localhost:7687"
      }
    },
    "everycode": {
      "command": "everycode-mcp",
      "args": ["--repo", "/path/to/your/repo"]
    },
    "dexto": {
      "command": "dexto-mcp",
      "args": ["--config", "~/Dexto/config.yaml"]
    }
  }
}
```

## Usage Examples

### Example 1: Bug Fixing

```
/agent-fix-bug "Login fails after password reset"

# Backend orchestration:
# 1. Prometheus: Classify issue → Bug
# 2. Prometheus: Reproduce in Docker
# 3. Prometheus: Generate patch via LangGraph
# 4. Dexto: Orchestrate verification workflow
# 5. Every Code: Auto Review validates quality
# 6. Prometheus: Run regression tests
```

### Example 2: Feature Implementation

```
/agent-plan "Add real-time notifications with WebSocket"
/agent-implement

# Backend orchestration:
# 1. Every Code: Generate implementation plan
# 2. Prometheus: Get context from similar features
# 3. Dexto: Create custom agent for implementation
# 4. Every Code: Execute code generation
# 5. Prometheus: Verify with AST analysis
```

### Example 3: Complex Orchestration

```
/agent-orchestrate "Migrate auth system to OAuth2
Steps: audit current system, design OAuth2 flow, implement, test, deploy"

# Backend orchestration:
# 1. Dexto: Create multi-agent workflow
# 2. Prometheus: Audit current auth (AST + KG)
# 3. Every Code: Design OAuth2 flow
# 4. Dexto: Coordinate implementation agents
# 5. Prometheus: Run integration tests
# 6. Dexto: Manage deployment pipeline
```

## Success Metrics

1. ✅ All three platforms accessible via MCP
2. ✅ Intelligent backend routing working
3. ✅ All 8 core skills functional
4. ✅ End-to-end workflows working
5. ✅ Multi-platform orchestration working
6. ✅ Documentation complete
7. ✅ Setup scripts available

## Implementation Timeline

### Phase 1: Foundation (Week 1)
- [x] Analyze all three architectures
- [x] Design unified integration strategy
- [ ] Create MCP server skeletons
- [ ] Implement intelligent router

### Phase 2: Platform Integrations (Week 2-3)
- [ ] Prometheus MCP server complete
- [ ] Every Code MCP server complete
- [ ] Dexto MCP server complete
- [ ] Test each platform independently

### Phase 3: Claude Code Skills (Week 3-4)
- [ ] Implement all 8 core skills
- [ ] Add backend selection logic
- [ ] Create skill compositions
- [ ] Add error handling

### Phase 4: Polish & Documentation (Week 4)
- [ ] Performance optimization
- [ ] Setup automation scripts
- [ ] User documentation
- [ ] Developer guide
- [ ] Release

## Next Steps

1. ✅ Architectures analyzed (COMPLETE)
2. ⏳ Complete MCP server implementations
3. ⏳ Create comprehensive skill suite
4. ⏳ Write setup automation
5. ⏳ Test all integrations
6. ⏳ Document and release
