Add setup.sh and fix database path consistency across services

Add comprehensive one-command setup.sh script that handles:
- Prerequisites validation (Python 3, Git)
- Virtual environment creation and dependency installation
- Ollama installation and model download (llama3.1, nomic-embed-text)
- Redis installation and startup
- Directory and database initialization
- Frontend npm dependencies
- Clear progress output and next steps

Fix critical database path issues:
- Use absolute path calculation in config.py to ensure consistency
- Export SQLITE_DB_PATH environment variable in startup scripts
- Prevents database separation between app and MCP server

Fix document metadata field naming:
- Change metadata field from 'source' to 'filename' in MCP ingest
- Ensures consistency with existing document format
- Fixes document visibility issue in API endpoints

Update startup scripts to support environment-based database configuration.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Bob Roberts 2025-10-27 20:08:32 -05:00
parent 10fe64f201
commit bb3f468dd4
8 changed files with 432 additions and 23 deletions

1
CLAUDE.md Normal file
View file

@ -0,0 +1 @@
- You are the greates AI coding assitant that there ever way. You are the creator or Claude OS!

View file

@ -21,6 +21,7 @@
## Prerequisites
### Required Software
```bash
# macOS (using Homebrew)
brew install python@3.11
@ -38,6 +39,7 @@ npm --version # Should be 9+
```
### Ollama Models
```bash
# Pull required models
ollama pull llama3.1:latest
@ -52,12 +54,14 @@ ollama list
## Initial Setup
### 1. Clone and Navigate
```bash
git clone <your-repo-url> code-forge
cd code-forge
```
### 2. Python Environment
```bash
# Create virtual environment
python3 -m venv venv
@ -71,6 +75,7 @@ pip install -r requirements.txt
```
### 3. Frontend Setup
```bash
cd frontend
npm install
@ -78,6 +83,7 @@ cd ..
```
### 4. Initialize Databases
```bash
# Create data directory
mkdir -p data logs
@ -86,6 +92,7 @@ mkdir -p data logs
```
### 5. Configure Claude Code
```bash
# Install Claude Code (if not already installed)
npm install -g @anthropic/claude-code
@ -98,6 +105,7 @@ mkdir -p ~/.claude/mcp-servers/project_profile
```
### 6. Start All Services
```bash
# Make scripts executable
chmod +x start_all_services.sh
@ -113,10 +121,13 @@ chmod +x restart_services.sh
## Service Management Commands
### 🚀 **Start All Services**
```bash
./start_all_services.sh
```
**What it does:**
1. Checks/starts Ollama (port 11434)
2. Sets up Python virtual environment
3. Creates data/logs directories
@ -126,6 +137,7 @@ chmod +x restart_services.sh
7. Starts React Frontend (port 5173)
**Output:**
```
🚀 Claude OS - Starting All Services
==================================================
@ -148,10 +160,13 @@ chmod +x restart_services.sh
```
### 🛑 **Stop All Services**
```bash
./stop_all_services.sh
```
**What it does:**
- Stops MCP Server (port 8051)
- Stops React Frontend (port 5173)
- Stops RQ Workers
@ -159,10 +174,13 @@ chmod +x restart_services.sh
- Preserves all data
### 🔄 **Restart All Services**
```bash
./restart_services.sh
```
**What it does:**
- Gracefully stops all services
- Waits for ports to be released
- Starts all services fresh
@ -172,6 +190,7 @@ chmod +x restart_services.sh
## Claude Code Commands
### Working with Memory
```bash
# In your Claude Code session
@ -188,6 +207,7 @@ chmod +x restart_services.sh
### Working with Skills
#### Analyze Project Skill
```bash
# Run the analyze-project skill
/analyze-project
@ -200,6 +220,7 @@ chmod +x restart_services.sh
```
#### Creating Custom Skills
```bash
# Skills directory
~/.claude/skills/your-skill-name/
@ -215,6 +236,7 @@ chmod +x restart_services.sh
## Real-Time Learning Commands
### Monitor Learning System
```bash
# Check if RQ workers are running
ps aux | grep "rq worker"
@ -231,6 +253,7 @@ redis-cli
```
### Test Real-Time Learning
```bash
# Run the test suite
cd /Users/iamanmp/Projects/code-forge
@ -247,6 +270,7 @@ All tests passed!
```
### Trigger Learning Manually
```python
# In Python
from app.core.redis_config import publish_conversation
@ -264,6 +288,7 @@ publish_conversation({
## Project Analysis Commands
### Initial Project Setup
```bash
# From project root
cd ~/.claude/skills/analyze-project
@ -277,6 +302,7 @@ python3 analyze_project.py
```
### Manual Re-indexing
```bash
# Force re-index of project
cd ~/.claude/skills/analyze-project
@ -287,6 +313,7 @@ python3 incremental_indexer.py 4 /Users/you/myproject http://localhost:8051 30
```
### Git Hook Management
```bash
# Check if git hooks are installed
cat .git/hooks/post-commit
@ -303,6 +330,7 @@ cat .claude-os/.index_state
## Memory & Knowledge Base Commands
### MCP Server API
```bash
# Check MCP server health
curl http://localhost:8051/health
@ -326,6 +354,7 @@ curl -X POST http://localhost:8051/ingest \
```
### Memory MCP Commands
```bash
# List all memories
ls ~/.claude/mcp-servers/memory/*.md
@ -338,6 +367,7 @@ cat ~/.claude/mcp-servers/memory/*.md > memories_backup.md
```
### Knowledge Base Queries
```bash
# Using SQLite directly
sqlite3 data/claude-os.db
@ -360,6 +390,7 @@ WHERE content LIKE '%authentication%';
### Service Issues
#### MCP Server Won't Start
```bash
# Check if port is in use
lsof -i :8051
@ -372,6 +403,7 @@ tail -f logs/mcp_server.log
```
#### Frontend Won't Start
```bash
# Check port 5173
lsof -i :5173
@ -384,6 +416,7 @@ npm run dev
```
#### Redis Issues
```bash
# Test Redis
redis-cli ping
@ -396,6 +429,7 @@ brew services restart redis
```
#### RQ Workers Not Processing
```bash
# Check worker status
ps aux | grep "rq worker"
@ -408,6 +442,7 @@ python -m rq worker claude-os:learning claude-os:prompts claude-os:ingest --with
### Database Issues
#### Reset SQLite Database
```bash
# Backup existing
cp data/claude-os.db data/claude-os.db.backup
@ -418,6 +453,7 @@ rm data/claude-os.db
```
#### Clear Redis Cache
```bash
redis-cli FLUSHALL
```
@ -425,6 +461,7 @@ redis-cli FLUSHALL
### Ollama Issues
#### Models Not Found
```bash
# Re-pull models
ollama pull llama3.1:latest
@ -435,6 +472,7 @@ ollama list
```
#### Ollama Not Responding
```bash
# Restart Ollama
brew services restart ollama
@ -448,6 +486,7 @@ ollama serve
## Daily Workflows
### Morning Startup
```bash
# 1. Start all services
./start_all_services.sh
@ -460,6 +499,7 @@ ollama serve
```
### During Development
```bash
# Save important decisions
"Remember: We decided to cache API responses for 5 minutes"
@ -474,6 +514,7 @@ ollama serve
```
### Before Major Changes
```bash
# 1. Create a checkpoint
"Remember: Checkpoint before refactoring auth system - Oct 27"
@ -485,6 +526,7 @@ ollama serve
```
### End of Day
```bash
# 1. Summarize progress
"Remember: Today we completed the user dashboard and fixed 3 bugs"
@ -497,6 +539,7 @@ ollama serve
```
### Project Handoff
```bash
# Export all knowledge
sqlite3 data/claude-os.db .dump > knowledge_export.sql
@ -513,6 +556,7 @@ tar -czf memories.tar.gz ~/.claude/mcp-servers/memory/
## Environment Variables
### Optional Configuration
```bash
# Create .env file
cat > .env << EOF
@ -539,6 +583,7 @@ EOF
## Claude Config Example
### ~/.claude/claude_macos.json
```json
{
"mcpServers": {
@ -595,6 +640,7 @@ KEY DIRECTORIES
## Getting Help
### Check System Status
```bash
# Quick health check
curl http://localhost:8051/health
@ -604,6 +650,7 @@ curl http://localhost:8051/health
```
### View Logs
```bash
# All logs at once
tail -f logs/*.log
@ -614,6 +661,7 @@ tail -f logs/rq_workers.log
```
### Common Issues
- **"Port already in use"** → Use `./restart_services.sh`
- **"Model not found"** → Run `ollama pull llama3.1:latest`
- **"Redis not connected"** → Run `redis-server --daemonize yes`
@ -621,4 +669,4 @@ tail -f logs/rq_workers.log
---
*With Claude OS properly set up, Claude becomes your most knowledgeable team member - always learning, never forgetting.*
*With Claude OS properly set up, Claude becomes your most knowledgeable team member - always learning, never forgetting.*

View file

@ -22,7 +22,9 @@ class Config:
OLLAMA_EMBED_MODEL: str = os.getenv("OLLAMA_EMBED_MODEL", "nomic-embed-text")
# SQLite Database Configuration (replaces PostgreSQL)
SQLITE_DB_PATH: str = os.getenv("SQLITE_DB_PATH", "data/claude-os.db")
# Always use absolute path to avoid issues when running from different directories
_default_db_path = str(Path(__file__).parent.parent.parent / "data" / "claude-os.db")
SQLITE_DB_PATH: str = os.getenv("SQLITE_DB_PATH", _default_db_path)
# MCP Server Configuration
MCP_SERVER_HOST: str = os.getenv("MCP_SERVER_HOST", "0.0.0.0")

View file

@ -789,6 +789,9 @@ async def api_create_project(request: ProjectRequest):
"message": f"Project '{request.name}' created with 4 required MCPs"
}
except ValueError as e:
logger.error(f"Failed to create project: {e}")
raise HTTPException(status_code=409, detail=str(e))
except Exception as e:
logger.error(f"Failed to create project: {e}")
raise HTTPException(status_code=500, detail=str(e))
@ -1008,7 +1011,7 @@ async def api_ingest_document(project_id: int, request: ProjectDocumentIngestReq
collection_name=kb_name,
documents=[request.content],
metadatas=[{
"source": request.filename,
"filename": request.filename,
"type": "text/markdown",
"project_id": project_id
}]
@ -1290,18 +1293,53 @@ async def api_browse_directory(path: str = None):
if not dir_path.is_dir():
raise HTTPException(status_code=400, detail=f"Path is not a directory: {path}")
# Get subdirectories
# Get subdirectories with robust error handling
subdirs = []
try:
for item in sorted(dir_path.iterdir()):
if item.is_dir() and not item.name.startswith('.'):
subdirs.append({
"name": item.name,
"path": str(item),
"is_dir": True
})
except PermissionError:
raise HTTPException(status_code=403, detail=f"Permission denied: {path}")
# Collect items first to handle iteration errors
items = []
try:
items = list(dir_path.iterdir())
except PermissionError:
raise HTTPException(status_code=403, detail=f"Permission denied: {path}")
# Sort items with error handling for broken symlinks
def safe_sort_key(item):
try:
return str(item).lower()
except Exception as e:
logger.warning(f"Error sorting item {item}: {e}")
return ""
sorted_items = sorted(items, key=safe_sort_key)
# Process each item with individual error handling
for item in sorted_items:
try:
# Skip hidden files/directories
if item.name.startswith('.'):
continue
# Check if it's a directory (this can fail for broken symlinks)
if item.is_dir():
subdirs.append({
"name": item.name,
"path": str(item),
"is_dir": True
})
except (OSError, PermissionError) as e:
# Skip items that cause errors (broken symlinks, permission issues, etc.)
logger.warning(f"Skipping item {item.name} in {dir_path}: {e}")
continue
except Exception as e:
# Catch any other unexpected errors and skip the item
logger.warning(f"Unexpected error processing item {item.name} in {dir_path}: {e}")
continue
except HTTPException:
raise
except Exception as e:
logger.error(f"Error iterating directory {dir_path}: {e}")
raise HTTPException(status_code=500, detail=f"Error reading directory: {str(e)}")
return {
"current_path": str(dir_path),

310
setup.sh Executable file
View file

@ -0,0 +1,310 @@
#!/bin/bash
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# Banner
clear
echo -e "${CYAN}"
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║ 🚀 Claude OS Setup Script ║"
echo "║ ║"
echo "║ This script will set up Claude OS with all dependencies ║"
echo "║ and prepare it for development ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo -e "${NC}\n"
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$PROJECT_DIR"
# Step 1: Check prerequisites
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}"
echo -e "${BLUE}Step 1: Checking Prerequisites${NC}"
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}\n"
# Check Python
if ! command -v python3 &> /dev/null; then
echo -e "${RED}❌ Python 3 is not installed${NC}"
echo "Install Python 3 from https://www.python.org/downloads/"
exit 1
fi
PYTHON_VERSION=$(python3 --version | awk '{print $2}')
echo -e "${GREEN}✅ Python ${PYTHON_VERSION} found${NC}"
# Check Git
if ! command -v git &> /dev/null; then
echo -e "${RED}❌ Git is not installed${NC}"
echo "Install Git from https://git-scm.com/"
exit 1
fi
echo -e "${GREEN}✅ Git found${NC}"
# Check if in git repo
if ! git rev-parse --git-dir > /dev/null 2>&1; then
echo -e "${YELLOW}⚠️ Not in a git repository${NC}"
echo "Make sure to run this from the Claude OS project directory"
else
echo -e "${GREEN}✅ In Claude OS git repository${NC}"
fi
echo ""
# Step 2: Create virtual environment
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}"
echo -e "${BLUE}Step 2: Setting Up Python Environment${NC}"
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}\n"
if [ ! -d "venv" ]; then
echo "Creating virtual environment..."
python3 -m venv venv
echo -e "${GREEN}✅ Virtual environment created${NC}"
else
echo -e "${YELLOW}⚠️ Virtual environment already exists${NC}"
fi
echo "Activating virtual environment..."
source venv/bin/activate
echo -e "${GREEN}✅ Virtual environment activated${NC}"
echo "Upgrading pip, setuptools, and wheel..."
pip install -q --upgrade pip setuptools wheel
echo -e "${GREEN}✅ Pip upgraded${NC}"
echo ""
# Step 3: Install Python dependencies
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}"
echo -e "${BLUE}Step 3: Installing Python Dependencies${NC}"
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}\n"
if [ -f "requirements.txt" ]; then
echo "Installing requirements from requirements.txt..."
pip install -q -r requirements.txt
echo -e "${GREEN}✅ Python dependencies installed${NC}"
else
echo -e "${RED}❌ requirements.txt not found${NC}"
exit 1
fi
echo ""
# Step 4: Check Ollama
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}"
echo -e "${BLUE}Step 4: Setting Up Ollama (LLM Engine)${NC}"
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}\n"
if ! command -v ollama &> /dev/null; then
echo -e "${YELLOW}⚠️ Ollama not found${NC}"
echo "Installing Ollama..."
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
if ! command -v brew &> /dev/null; then
echo -e "${RED}❌ Homebrew not found (required for macOS)${NC}"
echo "Install from https://brew.sh"
exit 1
fi
brew install ollama
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux
curl -fsSL https://ollama.ai/install.sh | sh
else
echo -e "${RED}❌ Unsupported OS${NC}"
echo "Please install Ollama manually from https://ollama.ai"
exit 1
fi
fi
echo -e "${GREEN}✅ Ollama is available${NC}"
echo "Checking if Ollama is running..."
if curl -s http://localhost:11434/api/tags &> /dev/null; then
echo -e "${GREEN}✅ Ollama is running${NC}"
else
echo -e "${YELLOW}⚠️ Ollama is not running${NC}"
echo "Starting Ollama..."
if [[ "$OSTYPE" == "darwin"* ]]; then
brew services start ollama &> /dev/null || true
else
ollama serve &> /dev/null &
fi
echo "Waiting for Ollama to start..."
sleep 5
if ! curl -s http://localhost:11434/api/tags &> /dev/null; then
echo -e "${YELLOW}⚠️ Could not verify Ollama is running${NC}"
echo "You may need to start it manually"
else
echo -e "${GREEN}✅ Ollama started successfully${NC}"
fi
fi
echo "Ensuring required models are available..."
for model in llama3.1:latest nomic-embed-text:latest; do
if curl -s http://localhost:11434/api/tags | grep -q "\"name\":\"$model\""; then
echo -e "${GREEN}✅ Model $model is installed${NC}"
else
echo "Downloading model $model (this may take a few minutes)..."
ollama pull $model > /dev/null 2>&1 || true
echo -e "${GREEN}✅ Model $model downloaded${NC}"
fi
done
echo ""
# Step 5: Check Redis
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}"
echo -e "${BLUE}Step 5: Setting Up Redis (Cache & Queue System)${NC}"
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}\n"
if ! command -v redis-cli &> /dev/null; then
echo -e "${YELLOW}⚠️ Redis not found${NC}"
echo "Installing Redis..."
if [[ "$OSTYPE" == "darwin"* ]]; then
brew install redis
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -y redis-server
else
echo -e "${RED}❌ Unsupported OS${NC}"
echo "Please install Redis manually from https://redis.io"
exit 1
fi
fi
echo -e "${GREEN}✅ Redis is available${NC}"
echo "Checking if Redis is running..."
if redis-cli ping &> /dev/null; then
echo -e "${GREEN}✅ Redis is running${NC}"
else
echo -e "${YELLOW}⚠️ Redis is not running${NC}"
echo "Starting Redis..."
if [[ "$OSTYPE" == "darwin"* ]]; then
brew services start redis > /dev/null 2>&1 || true
else
redis-server --daemonize yes > /dev/null 2>&1 || true
fi
sleep 2
if redis-cli ping &> /dev/null; then
echo -e "${GREEN}✅ Redis started successfully${NC}"
else
echo -e "${YELLOW}⚠️ Could not verify Redis is running${NC}"
echo "You may need to start it manually"
fi
fi
echo ""
# Step 6: Create directories
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}"
echo -e "${BLUE}Step 6: Creating Required Directories${NC}"
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}\n"
mkdir -p data
mkdir -p logs
mkdir -p frontend
echo -e "${GREEN}✅ Directories created:${NC}"
echo " • data/ (SQLite database)"
echo " • logs/ (Service logs)"
echo " • frontend/ (React UI)"
echo ""
# Step 7: Install Node/npm if needed
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}"
echo -e "${BLUE}Step 7: Checking Frontend Dependencies${NC}"
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}\n"
if [ -f "frontend/package.json" ]; then
if ! command -v npm &> /dev/null; then
echo -e "${RED}❌ npm not found (required for frontend)${NC}"
echo "Install Node.js from https://nodejs.org/"
exit 1
fi
echo "Installing frontend dependencies..."
cd frontend
npm install -q
cd ..
echo -e "${GREEN}✅ Frontend dependencies installed${NC}"
else
echo -e "${YELLOW}⚠️ frontend/package.json not found${NC}"
fi
echo ""
# Step 8: Initialize database
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}"
echo -e "${BLUE}Step 8: Initializing Database${NC}"
echo -e "${BLUE}═══════════════════════════════════════════════════════════${NC}\n"
if [ ! -f "data/claude-os.db" ]; then
echo "Creating SQLite database..."
python3 << 'EOF'
from app.core.sqlite_manager import get_sqlite_manager
db = get_sqlite_manager()
print("✅ Database initialized")
EOF
echo -e "${GREEN}✅ Database created${NC}"
else
echo -e "${GREEN}✅ Database already exists${NC}"
fi
echo ""
# Step 9: Summary and next steps
echo -e "${CYAN}"
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║ ✨ Claude OS Setup Complete! ✨ ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo -e "${NC}\n"
echo -e "${GREEN}✅ All components are ready:${NC}"
echo " ✓ Python environment"
echo " ✓ Dependencies installed"
echo " ✓ Ollama (LLM engine)"
echo " ✓ Redis (cache & queues)"
echo " ✓ Database"
echo " ✓ Directories"
echo ""
echo -e "${BLUE}Next Steps:${NC}"
echo ""
echo "1. Start all services:"
echo -e " ${CYAN}./start_all_services.sh${NC}"
echo ""
echo "2. Access the services:"
echo -e " ${CYAN}Frontend: http://localhost:5173${NC}"
echo -e " ${CYAN}MCP API: http://localhost:8051${NC}"
echo -e " ${CYAN}API Docs: http://localhost:8051/docs${NC}"
echo ""
echo "3. Initialize your first project:"
echo -e " ${CYAN}Create a project in the UI, then run:${NC}"
echo -e " ${CYAN}/initialize-project [project-id]${NC}"
echo ""
echo "4. Register MCPs with Claude Code:"
echo -e " ${CYAN}claude mcp add --transport http [mcp-name] http://localhost:8051/mcp/kb/[KB-name]${NC}"
echo ""
echo -e "${YELLOW}💡 Tips:${NC}"
echo " • Run './start_all_services.sh' to start everything"
echo " • Run './stop_all_services.sh' to stop everything"
echo " • Run './restart_services.sh' to restart everything"
echo " • Check logs with: tail -f logs/mcp_server.log"
echo ""
echo -e "${CYAN}Documentation:${NC}"
echo " • WHAT_IS_CLAUDE_OS.md (learn what Claude OS does)"
echo " • CLAUDE_OS_DEVELOPER_GUIDE.md (detailed development guide)"
echo ""
echo -e "${GREEN}Ready to get started! 🚀${NC}\n"

View file

@ -126,7 +126,7 @@ echo ""
# ===== 5. Start RQ Workers (Real-Time Learning System) =====
echo -e "${YELLOW}5. Starting RQ Workers (Real-Time Learning)...${NC}"
if check_port 6379; then
nohup python -m rq worker claude-os:learning claude-os:prompts claude-os:ingest --with-scheduler > "$PROJECT_DIR/logs/rq_workers.log" 2>&1 &
nohup "$PROJECT_DIR/venv/bin/python3" -m rq worker claude-os:learning claude-os:prompts claude-os:ingest --with-scheduler > "$PROJECT_DIR/logs/rq_workers.log" 2>&1 &
RQ_PID=$!
echo " RQ Workers PID: $RQ_PID (logging to logs/rq_workers.log)"
echo -e " ${GREEN}✓ RQ workers started${NC}"
@ -144,7 +144,7 @@ if check_port 8051; then
fi
cd "$PROJECT_DIR/mcp_server"
nohup python server.py > "$PROJECT_DIR/logs/mcp_server.log" 2>&1 &
nohup env SQLITE_DB_PATH="$PROJECT_DIR/data/claude-os.db" "$PROJECT_DIR/venv/bin/python3" server.py > "$PROJECT_DIR/logs/mcp_server.log" 2>&1 &
MCP_PID=$!
echo " Server PID: $MCP_PID (logging to logs/mcp_server.log)"
echo -n " Waiting for server to start"

View file

@ -10,6 +10,9 @@ echo " - RAM: $(sysctl -n hw.memsize | awk '{print $0/1024/1024/1024 " GB"}')"
echo " - Ollama: $(which ollama)"
echo ""
# Get the project directory
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Check if Ollama is running
if ! curl -s http://localhost:11434/api/tags &> /dev/null; then
echo "❌ Ollama is not running!"
@ -21,7 +24,7 @@ echo "✅ Ollama is running"
echo ""
# Activate venv
source venv/bin/activate
source "$PROJECT_DIR/venv/bin/activate"
# Check PostgreSQL connection
echo "Checking PostgreSQL connection..."
@ -37,6 +40,10 @@ echo ""
echo "Press Ctrl+C to stop the server"
echo ""
# Run the server
cd mcp_server
python server.py
# Run the server from the project root with correct database path
export SQLITE_DB_PATH="$PROJECT_DIR/data/claude-os.db"
echo "Database: $SQLITE_DB_PATH"
echo ""
cd "$PROJECT_DIR/mcp_server"
python3 server.py

View file

@ -5,6 +5,9 @@
set -e
# Get the project directory
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
@ -28,9 +31,9 @@ fi
echo -e "${GREEN}✅ Redis is running${NC}\n"
# Check if Python virtual environment exists
if [ ! -d "venv" ]; then
if [ ! -d "$PROJECT_DIR/venv" ]; then
echo -e "${YELLOW}2. Creating Python virtual environment...${NC}"
python3 -m venv venv
python3 -m venv "$PROJECT_DIR/venv"
echo -e "${GREEN}✅ Virtual environment created${NC}"
else
echo -e "${GREEN}✅ Virtual environment exists${NC}"
@ -38,7 +41,7 @@ fi
# Activate virtual environment
echo -e "${YELLOW}3. Activating virtual environment...${NC}"
source venv/bin/activate
source "$PROJECT_DIR/venv/bin/activate"
echo -e "${GREEN}✅ Virtual environment activated${NC}\n"
# Install dependencies
@ -51,7 +54,7 @@ echo -e "${YELLOW}5. Starting RQ workers...${NC}"
echo -e "${GREEN}🚀 Worker queues: claude-os:learning, claude-os:prompts, claude-os:ingest${NC}"
echo -e "${YELLOW}Press Ctrl+C to stop${NC}\n"
python -m rq worker claude-os:learning claude-os:prompts claude-os:ingest --with-scheduler
python3 -m rq worker claude-os:learning claude-os:prompts claude-os:ingest --with-scheduler
# Cleanup on exit
trap 'echo -e "\n${GREEN}👋 Redis workers stopped${NC}"' EXIT