# @reepoe/plugin

> **ReePoe AI Code Manager** - Install in any codebase for instant AI agent integration

Transform your codebase into an AI-optimized workspace in 30 seconds. ReePoe provides intelligent context management, token optimization, and seamless AI agent integration.

## 🚀 Quick Start

```bash
# Install globally
npm install -g @reepoe/plugin

# Navigate to your project
cd /path/to/your/project

# Start ReePoe
reepoe-start

# Query your codebase
reepoe query "what does this codebase do?"
```

That's it! ReePoe automatically:
- ✅ Detects your project type (Node.js, Python, Go, etc.)
- ✅ Scans your codebase
- ✅ Starts API server
- ✅ Optimizes context for AI agents

## 📦 What's Included

- **Multi-Language Support** - JavaScript, TypeScript, Python, Go, Rust, Java, and more
- **Smart Context** - Intelligent code analysis and context optimization
- **MiniRAG** - Pattern-based instant responses
- **Token Optimization** - 90%+ token reduction
- **API Server** - RESTful API for AI agent integration
- **Dashboard** - Real-time metrics and analytics

## 🛠️ Commands

### Server Management
```bash
reepoe-start   # Start ReePoe server in background
reepoe-stop    # Stop ReePoe server
reepoe-status  # Check server status and health
```

### Queries
```bash
reepoe query "show me all API endpoints"
reepoe query "find all test files"
reepoe query "explain the authentication system"
reepoe query "what's the project structure?"
```

## 📡 API Endpoints

Once started, ReePoe exposes:

```
GET  /health              - Health check
GET  /describe            - Full capability description
POST /query               - Natural language queries
GET  /metrics             - Performance analytics
GET  /token-analytics     - Token usage details
```

## 🎯 Use Cases

### For AI Agents
```javascript
// Claude, ChatGPT, or custom agents can query ReePoe
const response = await fetch('http://localhost:8000/query', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        instruction: 'analyze this codebase architecture'
    })
});
```

### For Developers
```bash
# Quick codebase insights
reepoe query "what external APIs are used?"
reepoe query "show me database models"
reepoe query "find security-related code"
```

### For Code Reviews
```bash
# Automated analysis
reepoe query "find all TODO comments"
reepoe query "show me recent changes to auth system"
reepoe query "what tests exist for the API?"
```

## 🔧 Configuration

ReePoe auto-configures on first start, but you can customize:

```json
// reepoe.config.json (auto-generated)
{
  "project": {
    "name": "my-awesome-app",
    "type": "javascript",
    "framework": "Express"
  },
  "api": {
    "port": 8000,
    "host": "127.0.0.1"
  },
  "mini_rag": {
    "enabled": true,
    "cta_whitelist": ["run_tests", "search_symbols"]
  }
}
```

## 📊 Supported Languages

| Language | Support Level | Symbol Extraction |
|----------|---------------|-------------------|
| JavaScript/TypeScript | ✅ Full | Functions, Classes, Interfaces, Types |
| Python | ✅ Full | Functions, Classes, Methods, Decorators |
| Go | ✅ Full | Functions, Structs, Interfaces, Methods |
| Rust | ⚠️  Generic | Functions, Structs, Traits |
| Java | ⚠️  Generic | Classes, Methods, Interfaces |
| C/C++ | ⚠️  Generic | Functions, Classes, Structs |

## 🏗️ Architecture

```
┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   AI Agents     │────│   ReePoe API    │────│  LLM Providers  │
│ (Claude, GPT)   │    │                 │    │  (OpenRouter)   │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                              │
                       ┌──────▼────────┐
                       │  Your Codebase │
                       │  (Any Language)│
                       └────────────────┘
```

## 💡 Features

### Intelligent Context Management
- Automatic codebase indexing
- Symbol-level navigation
- Context slicing and optimization
- Reference-based loading

### Token Optimization
- 90%+ token reduction
- Smart context compression
- Pattern-based caching (MiniRAG)
- Real-time usage tracking

### AI Agent Integration
- Standard REST API
- MCP (Model Context Protocol) support
- Auto-discovery via `/describe`
- Comprehensive onboarding

## 🐛 Troubleshooting

### Server won't start
```bash
# Check status
reepoe-status

# Check if port is in use
lsof -i :8000

# Try different port
# Edit reepoe.config.json and change api.port
```

### Binary permissions (Unix/Linux)
```bash
chmod +x ~/.npm-global/lib/node_modules/@reepoe/plugin/binaries/reepoe-*
```

### Reset configuration
```bash
rm reepoe.config.json
reepoe-start  # Will regenerate
```

## 📝 Requirements

- **Node.js** 16.0.0 or higher
- **Operating Systems:** macOS, Linux, Windows
- **Architecture:** x64, arm64

## 🔒 Security

- Runs locally on your machine
- No data sent to external servers (except configured LLM APIs)
- Closed-source binary distribution
- Whitelist-based CTA execution

## 📈 Performance

- **Install time:** < 60 seconds
- **Startup time:** < 3 seconds
- **Query latency:** < 2 seconds
- **Memory usage:** < 500MB

## 🆘 Support

- **Documentation:** https://reepoe.com/docs
- **Issues:** https://github.com/MarcAndre72/ReePoe/issues
- **API Reference:** http://localhost:8000/describe (after starting)

## 📄 License

Proprietary - See LICENSE file for details

---

**ReePoe** - Making AI agents smarter, one codebase at a time 🚀

