Skip to main content

Advanced memory management and RAG capabilities for AI assistants

Project description

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

pip install -e .

Usage

As a Service

ghost-brain

As a Python Package

from ghost_brain import Brain

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

Deployment Options

Local Development

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

Remote Desktop (for mobile users)

# 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

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

Team Sharing

# Deploy to shared server
# All team members use same URL in their Obsidian settings

Development

# 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

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

# 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ghost_brain-0.1.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ghost_brain-0.1.0-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file ghost_brain-0.1.0.tar.gz.

File metadata

  • Download URL: ghost_brain-0.1.0.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for ghost_brain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6b8d68df13ad95db8137a6db8761fdd229d4b49c6d979cacda8cf25d7d96a179
MD5 1e710600e7b00bea3086a2adcc5ba008
BLAKE2b-256 efe01fdb158ccf59c96f3ba1b78adf82ef89ad45d721a672aa93d020f7661815

See more details on using hashes here.

File details

Details for the file ghost_brain-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ghost_brain-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for ghost_brain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 270906ec2a4df09b3a36f928489295ce26e5d99cb41e72d0b2eee46bf470d81a
MD5 0d948f45ba1e8f068edc0935e1767bbc
BLAKE2b-256 78eb9d9ccd6cbef140f2501aead13033dada24d3fcb48dbce846fa749116560d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page