Metadata-Version: 2.4
Name: ghost-brain
Version: 0.1.0
Summary: Advanced memory management and RAG capabilities for AI assistants
Home-page: https://github.com/AmberLee2427/ghost-brain
Author: Ghost Project Team
Author-email: team@ghost.ai
Project-URL: Bug Reports, https://github.com/AmberLee2427/ghost-brain/issues
Project-URL: Source, https://github.com/AmberLee2427/ghost-brain
Project-URL: Documentation, https://github.com/AmberLee2427/ghost-brain#readme
Keywords: ai assistant memory rag embeddings llm
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=7.4.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: flake8>=6.0.0; extra == "dev"
Provides-Extra: txtai
Requires-Dist: txtai[all]>=5.6.0; extra == "txtai"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-python
Dynamic: summary

# Ghost Brain

The intelligent AI brain component for the Ghost project, providing memory management, RAG capabilities, and LLM integration.

## Features

- **Memory Management**: SQLite-based conversation history with embeddings
- **RAG System**: Semantic search with citations using `txtai`
- **LLM Integration**: Support for OpenAI and Google Gemini models
- **HTTP API**: RESTful interface for plugin communication
- **Intelligent Chunking**: Automatic conversation segmentation and summarization
- **Flexible Deployment**: Run locally, on remote desktops, or in the cloud
- **Mobile Support**: Connect mobile Obsidian to desktop brain servers

## Installation

```bash
pip install -e .
```

## Usage

### As a Service
```bash
ghost-brain
```

### As a Python Package
```python
from ghost_brain import Brain

brain = Brain()
response = await brain.process_message("Hello, how are you?")
```

### Deployment Options

#### Local Development
```bash
# Start brain server locally
python -m ghost_brain.server
# Default: http://localhost:8000
```

#### Remote Desktop (for mobile users)
```bash
# Install on desktop
python -m pip install ghost-brain

# Start brain server
python -m ghost_brain.server

# Find desktop IP
ifconfig  # Mac/Linux
ipconfig  # Windows

# Mobile users connect to: http://YOUR_DESKTOP_IP:8000
```

#### Cloud Deployment
```bash
# Deploy to Railway, Heroku, etc.
# Users connect to: https://your-deployment-url.com
```

#### Team Sharing
```bash
# Deploy to shared server
# All team members use same URL in their Obsidian settings
```

## Development

```bash
# Create the dev environment
pip install -r requirements.txt

# Install in editable mode
pip install -e .

# Run tests
pytest

# Start development server
uvicorn ghost_brain.server:app --reload
```

## API Endpoints

- `POST /chat` - Process a chat message
- `GET /health` - Health check
- `POST /memory/search` - Search memory
- `GET /memory/stats` - Get memory statistics
- `GET /settings` - Get current settings
- `POST /settings` - Update settings

## Configuration

### Brain Server Settings
The Obsidian plugin supports configurable brain server connections:

- **Local Mode**: Default localhost:8000 configuration
- **Custom Mode**: Connect to any brain server URL
- **Port Configuration**: Customize local brain server port
- **Status Monitoring**: Real-time connection health checks

### Settings Interface
```typescript
brainServer: {
    useCustomBrainServer: boolean;
    brainServerUrl: string;
    brainServerPort: number;
}
```

## Architecture

The brain consists of several core modules:

- **Memory Manager**: Handles conversation storage and retrieval
- **LLM Handler**: Manages API calls to language models
- **RAG Engine**: Provides semantic search capabilities
- **HTTP Server**: Exposes functionality via REST API
- **Settings Manager**: Handles configuration and deployment options

## Use Cases

### Desktop Users
- Default localhost:8000 configuration
- No changes needed
- Brain server runs on same machine

### Mobile Users
- Install brain on desktop
- Use desktop IP address in mobile settings
- No Python installation needed on mobile

### Cloud/Team Users
- Deploy brain to cloud service
- Share one brain server across team members
- Centralized memory and processing

## Testing

```bash
# Test brain server connectivity
python test_brain_server.py

# Test Obsidian integration
python test_obsidian_integration.py

# Test settings integration
python test_settings_integration.py
``` 
