### PAKE+ System Manual Setup - Docker & Git Hooks Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/README.md This snippet outlines the manual steps for starting the Docker infrastructure and installing Git hooks for the PAKE+ System. It involves navigating to the docker directory to bring up services and then executing a script to install the Git validation hooks. ```bash # 3. Start Docker infrastructure cd docker && docker-compose up -d && cd .. # 4. Install Git hooks python scripts/install-hooks-simple.py ``` -------------------------------- ### Start Gemini CLI Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/GEMINI_PAKE_INTEGRATION_COMPLETE.md This command initiates the Gemini CLI. After installation and navigation, this is the next step to interact with Gemini, often leading to authentication prompts. ```cmd gemini ``` -------------------------------- ### Run Next.js Development Server Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/frontend/README.md Commands to start the Next.js development server using different package managers. This allows for local development and testing of the application. ```bash npm run dev ``` ```bash yarn dev ``` ```bash pnpm dev ``` ```bash bun dev ``` -------------------------------- ### Start PAKE Automation Services Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/QUICK_START_AUTOMATION.md Commands to start the PAKE automation services using either PowerShell or a batch file. ```PowerShell .\start_pake_automation.ps1 ``` ```Batch start_pake_automation.bat ``` -------------------------------- ### Development Setup: Install, Build, Test, and Lint Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/services/agent-runtime/README.md Provides essential bash commands for setting up the development environment, including installing dependencies, building the project, running tests, and performing linting and formatting. ```bash # Install dependencies npm install # Build TypeScript npm run build # Run tests npm test # Run with coverage npm run test:coverage # Lint and format npm run lint npm run format ``` -------------------------------- ### Start Services in Dependency Order Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md Starts all registered services in an order determined by their dependencies. It logs the startup process and returns a boolean indicating success or failure. ```Python async def start_all_services(self): """Start all services in dependency order""" logger.info("🚀 Starting all services...") # Determine start order based on dependencies start_order = self._get_start_order() for service_name in start_order: if not await self.start_service(service_name): logger.error(f"❌ Failed to start {service_name}, aborting startup") return False # Small delay between services await asyncio.sleep(2) logger.info("✅ All services started successfully") return True ``` -------------------------------- ### Quick Test Start PAKE Automation Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/QUICK_START_AUTOMATION.md Starts the PAKE automation script using PowerShell or a batch file. This is the recommended first step for testing. ```PowerShell # Open PowerShell in PAKE_SYSTEM directory cd "D:\Projects\PAKE_SYSTEM" .\start_pake_automation.ps1 ``` ```Batch start_pake_automation.bat ``` -------------------------------- ### Install Dependencies and Run PAKE Service Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/services/secrets-manager/README.md This snippet covers the essential bash commands to install project dependencies, start a development Vault server, initialize Vault engines, run tests, and start the PAKE service for development. ```bash # Install dependencies npm install # Start development Vault server npm run vault:dev # Initialize Vault engines npm run vault:init # Run tests npm test # Start the service npm run dev ``` -------------------------------- ### PAKE System Quick Start: Prerequisites Installation Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/kubernetes/README.md Installs essential command-line tools for Kubernetes management, including kubectl, Helm, and Argo CD, and verifies their installations. ```bash # Install required tools brew install kubectl helm argocd kubectl version --client helm version argocd version ``` -------------------------------- ### Pre-commit Hooks Setup (Bash) Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/CONTRIBUTING.md Shows how to install and set up pre-commit hooks for automated code checks before committing, including installing the package and running it manually. ```bash # Install pre-commit pip install pre-commit # Setup hooks pre-commit install # Run manually pre-commit run --all-files ``` -------------------------------- ### PAKE+ System One-Command Deployment Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/README.md This bash script provides a streamlined deployment process for the PAKE+ System. It automates prerequisite checks, dependency installation, Docker infrastructure setup, database initialization, API configuration, ingestion pipeline setup, and Git hook installation. ```bash cd PAKE_SYSTEM python scripts/deploy_pake.py ``` -------------------------------- ### Troubleshoot PAKE Services Not Starting Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/QUICK_START_AUTOMATION.md PowerShell commands to check logs, force stop, and restart PAKE automation services when they are not starting. ```PowerShell # Check logs Get-Content logs\*.log | Select-Object -Last 20 # Force stop and restart .\stop_pake_automation.ps1 .\start_pake_automation.ps1 ``` -------------------------------- ### Start Service Method - Python Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md The `start_service` method initiates the startup process for a given service. It first checks if a `start_command` is defined for the service. If so, it logs the action and proceeds to execute the command, potentially handling dependencies. ```Python async def start_service(self, service_name: str) -> bool: """Start a service""" config = self.services[service_name] if not config.start_command: logger.warning(f"No start command defined for {service_name}") return False logger.info(f"Starting {config.name}...") try: # Check dependencies first if config.dependencies: for dep in config.dependencies: ``` -------------------------------- ### Main Deployment Automation (Shell) Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md The main deployment function orchestrates the entire PAKE+ system setup. It sequentially executes environment validation, dependency installation, Docker infrastructure deployment, service health checks, database initialization, and the startup of various backend services and bridges. It also handles Git hooks, sample content creation, integration tests, and monitoring setup, concluding with a success message and service status overview. ```shell main_deployment() { log "🚀 Starting PAKE+ Master Deployment" log "==================================" # Step 1: Environment validation log "Step 1: Environment Validation" if ! run_with_timeout 60 "scripts/validate_environment.sh"; then log "❌ Environment validation failed" exit 1 fi # Step 2: Dependency installation log "Step 2: Dependency Installation" if ! run_with_timeout 600 "scripts/install_dependencies.sh"; then log "❌ Dependency installation failed" exit 1 fi # Step 3: Docker infrastructure deployment log "Step 3: Docker Infrastructure Deployment" cd docker # Pull latest images run_with_timeout 600 "docker-compose pull" # Start services run_with_timeout 120 "docker-compose up -d" cd .. # Step 4: Wait for core services log "Step 4: Service Health Checks" # Wait for PostgreSQL wait_for_service "PostgreSQL" "http://localhost:5433" 120 # Wait for Redis if ! timeout 60 bash -c 'until redis-cli -h localhost -p 6380 ping; do sleep 2; done'; then log "❌ Redis failed to start" exit 1 fi log "✅ Redis is healthy" # Step 5: Database initialization log "Step 5: Database Initialization" run_with_timeout 60 "python3 scripts/init_database.py" # Step 6: Start MCP server log "Step 6: MCP Server Startup" cd mcp-servers nohup python3 base_server.py > ../logs/mcp_server.log 2>&1 & echo $! > ../logs/mcp_server.pid cd .. wait_for_service "MCP Server" "http://localhost:8000/health" 120 # Step 7: Start API Bridge log "Step 7: API Bridge Startup" cd scripts nohup node obsidian_bridge.js > ../logs/api_bridge.log 2>&1 & echo $! > ../logs/api_bridge.pid cd .. wait_for_service "API Bridge" "http://localhost:3000/health" 60 # Step 8: Start Ingestion Manager log "Step 8: Ingestion Manager Startup" cd scripts nohup python3 ingestion_manager.py > ../logs/ingestion_manager.log 2>&1 & echo $! > ../logs/ingestion_manager.pid cd .. wait_for_service "Ingestion Manager" "http://localhost:8001" 60 # Step 9: Install Git hooks log "Step 9: Git Hooks Installation" run_with_timeout 30 "python3 scripts/install-hooks-simple.py" # Step 10: Initialize sample content log "Step 10: Sample Content Creation" run_with_timeout 30 "python3 scripts/create_sample_content.py" # Step 11: Run comprehensive tests log "Step 11: System Integration Tests" run_with_timeout 300 "scripts/run_integration_tests.sh" # Step 12: Start monitoring log "Step 12: Monitoring Setup" run_with_timeout 60 "scripts/start_monitoring.sh" log "🎉 PAKE+ deployment completed successfully!" log "Services running:" log " - PostgreSQL: localhost:5433" log " - Redis: localhost:6380" log " - MCP Server: http://localhost:8000" log " - API Bridge: http://localhost:3000" log " - n8n: http://localhost:5678" log " - Ingestion Manager: http://localhost:8001" # Generate deployment report python3 scripts/generate_deployment_report.py } ``` -------------------------------- ### PAKE+ System Environment Setup Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/README.md This snippet demonstrates the initial steps for setting up the PAKE+ System environment. It includes copying an example environment file, editing it with specific credentials and API keys, and highlights the importance of not committing secrets to version control. ```bash # Copy environment template cp .env.example .env # Edit the .env file with your actual values: # - Replace all placeholder passwords with strong, unique values # - Add your actual API keys # - Configure your specific database/service settings nano .env # or use your preferred editor ``` -------------------------------- ### Basic Gemini CLI Usage Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/GEMINI_CLI_SETUP_INSTRUCTIONS.md Provides examples of basic Gemini CLI commands, including interactive mode, single prompt execution, and debug mode. ```bash # Interactive mode gemini # Single prompt gemini --prompt "Your question here" # Debug mode gemini --debug --prompt "Your question here" ``` -------------------------------- ### Install Node.js Dependencies with NPM Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md Installs Node.js dependencies using npm. It navigates to the 'scripts' directory, runs 'npm install' for project dependencies, and installs global packages like pm2 and nodemon. ```bash set -euo pipefail # Function to install Node.js dependencies install_node_deps() { echo "📦 Installing Node.js dependencies..." cd scripts # Install dependencies npm install # Install global dependencies if needed npm install -g pm2 nodemon cd .. echo "✅ Node.js dependencies installed" } # Main execution part calling install_node_deps # install_node_deps ``` -------------------------------- ### PAKE System Agent Process Examples Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/ENHANCED_MCP_IMPLEMENTATION_GUIDE.md These examples illustrate the agent's process for different tasks within the PAKE system. They detail the steps involved in autonomous research, knowledge synthesis, and daily review sessions, highlighting the agent's interaction with tools and data. ```text Prompt: "Research the latest developments in context engineering for AI systems and create comprehensive SourceNotes" Agent Process: 1. Uses external tools to find authoritative sources 2. Searches existing vault to avoid duplication 3. Extracts and processes content with proper metadata 4. Creates structured SourceNotes with confidence scores 5. Reports completion with PAKE IDs and recommendations ``` ```text Prompt: "Synthesize insights about effective knowledge management systems from existing SourceNotes" Agent Process: 1. Searches vault for relevant SourceNotes on knowledge management 2. Retrieves full content of discovered notes 3. Analyzes patterns, agreements, and contradictions 4. Creates InsightNote with novel understanding 5. Provides full traceability to source materials ``` ```text Human Process: 1. Opens Daily Review Dashboard 2. Reviews priority queue (quarantined/low confidence items) 3. For each note: validates accuracy, updates status, adds feedback 4. Documents common issues for agent instruction updates 5. Updates agent prompts based on patterns identified ``` -------------------------------- ### Development Environment Setup (Bash) Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/CONTRIBUTING.md Details the steps for setting up the development environment, including checking Python version, creating and activating a virtual environment, and installing project dependencies using pip. ```bash # Python 3.9+ python --version # Virtual environment python -m venv venv source venv/bin/activate # Linux/Mac # or virtualenv\Scripts\activate # Windows # Install dependencies pip install -r requirements.txt pip install -r requirements-dev.txt ``` -------------------------------- ### Troubleshoot Python Not Found Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/QUICK_START_AUTOMATION.md Bash command to check Python installation and a note on adding Python to PATH or reinstalling if not found. ```Bash # Check Python installation python --version # If not found, add Python to PATH or reinstall ``` -------------------------------- ### PAKE System Quick Start: Cluster Setup Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/kubernetes/README.md Clones the PAKE system Kubernetes infrastructure repository and executes scripts to set up development, staging, and production clusters. ```bash # Clone repository git clone https://github.com/pake-system/kubernetes-infrastructure cd kubernetes-infrastructure # Setup development cluster ./scripts/setup-cluster.sh dev # Setup staging cluster ./scripts/setup-cluster.sh staging # Setup production cluster ./scripts/setup-cluster.sh prod ``` -------------------------------- ### Install System Dependencies (Ubuntu/Debian and CentOS/RHEL) Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md Installs system-level dependencies using package managers. It checks for 'apt-get' (Debian/Ubuntu) or 'yum' (CentOS/RHEL) and installs common utilities like curl, jq, netcat, lsof, htop, postgresql-client, and redis-tools. If no known package manager is found, it provides manual installation instructions. ```bash set -euo pipefail # Function to install system dependencies (Ubuntu/Debian) install_system_deps() { if command -v apt-get &> /dev/null; then echo "🔧 Installing system dependencies (apt)..." sudo apt-get update sudo apt-get install -y \ curl \ jq \ netcat \ lsof \ htop \ postgresql-client \ redis-tools echo "✅ System dependencies installed" elif command -v yum &> /dev/null; then echo "🔧 Installing system dependencies (yum)..." sudo yum update -y sudo yum install -y \ curl \ jq \ nc \ lsof \ htop \ postgresql \ redis echo "✅ System dependencies installed" else echo "⚠️ Package manager not detected. Please install dependencies manually:" echo " - curl, jq, netcat, lsof, htop" echo " - postgresql-client, redis-tools" fi } # Main execution part calling install_system_deps # install_system_deps ``` -------------------------------- ### Start Service with Health Check Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md Starts a service using its configured start command and waits for it to become healthy within a specified timeout. It checks dependencies first and logs success or failure. ```Python async def start_service(self, service_name: str) -> bool: """Start a service""" config = self.services[service_name] # Check dependencies for dep in config.dependencies: if not await self.check_service_health(dep): logger.error(f"Dependency {dep} is not healthy, cannot start {service_name}") return False # Execute start command process = await asyncio.create_subprocess_shell( config.start_command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE ) stdout, stderr = await process.communicate() if process.returncode == 0: logger.info(f"✅ {config.name} start command executed") # Wait for service to become healthy for attempt in range(config.startup_timeout // 5): if await self.check_service_health(service_name): logger.info(f"✅ {config.name} is healthy") self.service_status[service_name] = 'running' return True await asyncio.sleep(5) logger.error(f"❌ {config.name} failed to become healthy within timeout") return False else: logger.error(f"❌ {config.name} start command failed: {stderr.decode()}") return False except Exception as e: logger.error(f"❌ Error starting {service_name}: {e}") return False ``` -------------------------------- ### PAKE+ System Manual Setup - Python & Node.js Dependencies Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/README.md This snippet details the manual installation of Python and Node.js dependencies required for the PAKE+ System. It covers installing Python packages using pip and Node.js packages using npm, along with navigating to the correct directories. ```bash # 1. Install Python dependencies pip install -r mcp-servers/requirements.txt pip install -r scripts/requirements_ingestion.txt # 2. Install Node.js dependencies cd scripts && npm install && cd .. ``` -------------------------------- ### Install Gemini CLI Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/GEMINI_PAKE_INTEGRATION_COMPLETE.md This snippet shows the command to install the Gemini CLI globally using npm. It's a prerequisite for using Gemini's features. ```bash npm install -g @google/gemini-cli ``` -------------------------------- ### Install NLP Models using Python Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md Installs Natural Language Processing (NLP) models using Python. It downloads the 'en_core_web_sm' model for spaCy and the 'all-MiniLM-L6-v2' model for sentence transformers. ```python set -euo pipefail # Function to download and install NLP models install_nlp_models() { echo "🧠 Installing NLP models..." # Install spaCy English model python3 -m spacy download en_core_web_sm # Download sentence transformer model (will be cached) python3 -c " from sentence_transformers import SentenceTransformer print('Downloading sentence transformer model...') SentenceTransformer('all-MiniLM-L6-v2') print('✅ Model downloaded and cached') " echo "✅ NLP models installed" } # Main execution part calling install_nlp_models # install_nlp_models ``` -------------------------------- ### Add Startup Delay to PAKE Script Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/QUICK_START_AUTOMATION.md Example of how to add a startup delay to the `start_pake_automation.ps1` script by inserting a `Start-Sleep` command. ```PowerShell Start-Sleep -Seconds 10 # 10 second delay ``` -------------------------------- ### Determine Service Startup Order Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md Calculates the correct order to start services based on their declared dependencies. It handles potential circular dependencies by logging an error. ```Python def _get_start_order(self) -> List[str]: """Determine service start order based on dependencies""" start_order = [] remaining = set(self.services.keys()) while remaining: # Find services with no unmet dependencies ready = [] for service_name in remaining: config = self.services[service_name] if not config.dependencies or all(dep in start_order for dep in config.dependencies): ready.append(service_name) if not ready: # Circular dependency or invalid configuration logger.error("Circular dependency detected in service configuration") return list(remaining) # Add ready services to start order for service_name in ready: start_order.append(service_name) remaining.remove(service_name) return start_order ``` -------------------------------- ### API Bridge Startup Script (Node.js) Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md This Node.js script is responsible for starting the API Bridge service for the PAKE+ system. It is executed in the background using `nohup` and its output and PID are redirected to log files. ```javascript nohup node obsidian_bridge.js > ../logs/api_bridge.log 2>&1 & echo $! > ../logs/api_bridge.pid ``` -------------------------------- ### Configure Auditd for Monitoring Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/SECURITY-HARDENING.md This section shows how to install `auditd`, configure it to monitor specific directories for access, and view the audit logs. ```bash # Install auditd for file access monitoring sudo apt install auditd # Monitor vault directory access sudo auditctl -w /opt/pake-system/vault -p wa -k pake-vault-access # Monitor configuration changes sudo auditctl -w /etc/pake-system/ -p wa -k pake-config-changes # View audit logs sudo ausearch -k pake-vault-access ``` -------------------------------- ### Automated System Deployment Script Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md A master deployment script that orchestrates the system setup. It includes logging to a file, executing commands with timeouts, and waiting for services to become healthy via HTTP health checks. ```bash #!/bin/bash # File: scripts/master_deploy.sh set -euo pipefail # Configuration DEPLOYMENT_LOG="logs/deployment_$(date +%Y%m%d_%H%M%S).log" HEALTH_CHECK_TIMEOUT=300 HEALTH_CHECK_INTERVAL=10 # Ensure logs directory exists mkdir -p logs # Logging function log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$DEPLOYMENT_LOG" } # Function to run with timeout and logging run_with_timeout() { local timeout=$1 local cmd="${@:2}" log "Executing: $cmd" if timeout "$timeout" bash -c "$cmd" 2>&1 | tee -a "$DEPLOYMENT_LOG"; then log "✅ Command succeeded: $cmd" return 0 else log "❌ Command failed: $cmd" return 1 fi } # Function to wait for service health wait_for_service() { local service_name=$1 local health_url=$2 local timeout=${3:-$HEALTH_CHECK_TIMEOUT} log "Waiting for $service_name to be healthy..." local elapsed=0 while [[ $elapsed -lt $timeout ]]; do if curl -f -s "$health_url" >/dev/null 2>&1; then log "✅ $service_name is healthy" return 0 fi sleep $HEALTH_CHECK_INTERVAL elapsed=$((elapsed + HEALTH_CHECK_INTERVAL)) log " Waiting for $service_name... (${elapsed}s/${timeout}s)" done log "❌ $service_name failed to become healthy within ${timeout}s" return 1 } # Example usage (commented out): # log "Starting deployment process..." # run_with_timeout 60 "echo 'Running a sample command'" # wait_for_service "MyService" "http://localhost:8080/health" # log "Deployment process finished." ``` -------------------------------- ### Run Uvicorn Server Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md The main entry point for running the FastAPI application using Uvicorn. This command starts the web server, making the orchestrator API accessible on the specified host and port. ```Python if __name__ == "__main__": import uvicorn uvicorn.run(app, host="0.0.0.0", port=8002) ``` -------------------------------- ### Execute PAKE System Deployment (Batch) Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/ZERO_TOUCH_DEPLOYMENT_README.md This script initiates the zero-touch deployment of the PAKE system using a batch file. It's the simplest method, requiring only a double-click to start the automated installation and configuration process. ```bash # Just double-click this file: DEPLOY.bat ``` ```bash # Standard zero-touch deployment DEPLOY.bat ``` -------------------------------- ### PAKE+ System Manual Setup - Sample Content Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/README.md This command demonstrates how to manually initialize sample content within the PAKE+ System after the core setup is complete. It uses a specific component flag with the deployment script to generate initial data. ```bash # 5. Initialize sample content python scripts/deploy_pake.py --component sample-content ``` -------------------------------- ### Install Python Dependencies with Pip Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md Installs Python dependencies using pip, including upgrading pip, installing requirements from specified files (MCP server and ingestion pipeline), and installing specific packages like psycopg2-binary and sqlite3. ```bash set -euo pipefail echo "📦 PAKE+ Dependency Installation" echo "================================" # Function to install Python dependencies install_python_deps() { echo "🐍 Installing Python dependencies..." # Upgrade pip python3 -m pip install --upgrade pip # Install MCP server dependencies if [[ -f "mcp-servers/requirements.txt" ]]; then echo " Installing MCP server dependencies..." python3 -m pip install -r mcp-servers/requirements.txt fi # Install ingestion pipeline dependencies if [[ -f "scripts/requirements_ingestion.txt" ]]; then echo " Installing ingestion pipeline dependencies..." python3 -m pip install -r scripts/requirements_ingestion.txt fi # Install deployment script dependencies python3 -m pip install psycopg2-binary sqlite3 echo "✅ Python dependencies installed" } # Main execution part calling install_python_deps # install_python_deps ``` -------------------------------- ### Start Frontend Development Server Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/README.md Navigates to the frontend directory and starts the development server using npm. The application will be accessible at http://localhost:3001. ```bash cd frontend npm run dev # Access at http://localhost:3001 ``` -------------------------------- ### FastAPI Endpoint: Start Orchestrator Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md An API endpoint to start the continuous scheduling of the ingestion orchestrator. It prevents starting if the orchestrator is already running and initiates the continuous run process in a background task. ```Python @app.post("/start") async def start_orchestrator(): """Start continuous scheduling""" if orchestrator.running: raise HTTPException(status_code=400, detail="Orchestrator already running") asyncio.create_task(orchestrator.run_continuous()) return {"message": "Orchestrator started"} ``` -------------------------------- ### Start Production Server with npm Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/frontend/UI_UX_COMPLETION_REPORT.md Initiates the production server to serve the application. This command is used after the build process is complete. ```bash npm run start ``` -------------------------------- ### Run Simple Demonstration (Python) Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/PROACTIVE_WORKFLOW_INTEGRATION_GUIDE.md Executes a simple demonstration of the Pake System's workflow capabilities using Python's asyncio. It sets up the system path and runs a predefined asynchronous demonstration function. ```Python import asyncio import sys sys.path.append('.') from services.workflows.demo_simple import simple_demonstration asyncio.run(simple_demonstration()) ``` -------------------------------- ### PAKE Automation Test Note Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/QUICK_START_AUTOMATION.md Markdown content for a test note to verify PAKE automation processing, including expected frontmatter. ```Markdown # Test Automation This note should be automatically processed with: - PAKE ID - Confidence score - AI summary - Processing timestamp ``` ```YAML --- pake_id: 12345-abcd-6789-efgh confidence_score: 0.65 ai_summary: "Topic: Test Automation | ~15 words" automated_processing: true last_processed: "2025-08-23T10:30:45" --- ``` -------------------------------- ### Start Development Server (Bash) Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/frontend/UI_UX_COMPLETION_REPORT.md Provides the bash command to navigate to the frontend project directory and start the development server using npm. ```bash # Start development server cd D:/Projects/PAKE_SYSTEM/frontend npm run dev ``` -------------------------------- ### Install git-filter-repo for Git History Cleanup Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/rotate-secrets.md Instructions for installing the git-filter-repo tool on Windows using pip, conda, or manual download and execution. ```bash # Using pip pip install git-filter-repo # OR using conda conda install -c conda-forge git-filter-repo # OR manual installation curl -o git-filter-repo https://raw.githubusercontent.com/newren/git-filter-repo/main/git-filter-repo chmod +x git-filter-repo mv git-filter-repo /usr/local/bin/ ``` -------------------------------- ### PAKE Integration Commands Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/GEMINI_CLI_SETUP_INSTRUCTIONS.md Demonstrates PAKE-specific commands for interacting with the PAKE system, such as searching notes, retrieving specific notes, and creating new notes. ```bash # Search vault gemini --prompt "Search for notes about 'AI development' in my PAKE vault" # Get specific note gemini --prompt "Retrieve the full content of note with PAKE ID: [id]" # Create new note gemini --prompt "Create a new SourceNote about [topic] with proper metadata" ``` -------------------------------- ### Troubleshoot Application Startup Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/configs/free-production-deployment.md This snippet provides bash commands to troubleshoot application startup issues. It includes commands to tail application logs, view systemd service logs, and view Docker Compose container logs. ```bash # Check logs tail -f logs/application.log ``` ```bash # For systemd service sudo journalctl -u pake-system -f ``` ```bash # For Docker docker-compose logs -f pake-system ``` -------------------------------- ### Deploy to Fly.io with Services and Secrets Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/configs/free-production-deployment.md This bash script installs the Fly.io CLI, logs in, creates a new app, provisions PostgreSQL and Redis databases, sets secrets including generated passwords and API keys, and deploys the application using 'fly deploy'. ```bash # Install flyctl curl -L https://fly.io/install.sh | sh # Login and create app fly auth login fly apps create pake-system # Add PostgreSQL fly postgres create --name pake-postgres # Add Redis fly redis create --name pake-redis # Set secrets fly secrets set DB_PASSWORD=$(openssl rand -base64 24) fly secrets set REDIS_PASSWORD=$(openssl rand -base64 16) fly secrets set OPENAI_API_KEY=sk-your-actual-key fly secrets set ANTHROPIC_API_KEY=sk-ant-your-actual-key # Deploy fly deploy ``` -------------------------------- ### Install and Run PAKE System (Bash) Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/services/ai-security/README.md Provides commands to install dependencies, run tests (including specific security tests like prompt injection and model protection), and start the development service for the PAKE system. ```bash # Install dependencies npm install # Run tests npm test # Run specific security tests npm run test:prompt-injection npm run test:model-protection npm run test:adversarial npm run test:cost-controls # Start the service npm run dev ``` -------------------------------- ### Monitor PAKE Automation Logs Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/QUICK_START_AUTOMATION.md PowerShell commands for real-time log monitoring of PAKE automation, including live log tailing and checking processing activity. ```PowerShell # PowerShell - Live log tail Get-Content logs\vault_automation.log -Wait -Tail 10 # Check processing activity Get-Content logs\automation_session*.log -Wait ``` -------------------------------- ### Restart Service Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md Restarts a service. It prioritizes using a configured restart command. If not available, it falls back to stopping and then starting the service. ```Python async def restart_service(self, service_name: str) -> bool: """Restart a service""" config = self.services[service_name] # Use restart command if available, otherwise stop and start if config.restart_command: logger.info(f"Restarting {config.name}...") try: process = await asyncio.create_subprocess_shell( config.restart_command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE ) stdout, stderr = await process.communicate() if process.returncode == 0: # Wait for service to become healthy for attempt in range(config.startup_timeout // 5): if await self.check_service_health(service_name): logger.info(f"✅ {config.name} restarted successfully") return True await asyncio.sleep(5) logger.error(f"❌ {config.name} failed to become healthy after restart") return False else: logger.error(f"❌ {config.name} restart command failed: {stderr.decode()}") return False except Exception as e: logger.error(f"❌ Error restarting {service_name}: {e}") return False else: # Stop and start await self.stop_service(service_name) await asyncio.sleep(5) return await self.start_service(service_name) ``` -------------------------------- ### Agent Workflows Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/GEMINI_CLI_SETUP_INSTRUCTIONS.md Shows how to use the Gemini CLI for agent-based workflows, such as research and synthesis, within the PAKE system. ```bash # Research workflow gemini --prompt "Act as a PAKE Ingestion Agent and research the topic: [your topic]" # Synthesis workflow gemini --prompt "Act as a PAKE Synthesis Agent and create insights from existing notes about [topic]" ``` -------------------------------- ### Initialize QualityAssurancePipeline Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md Initializes the QualityAssurancePipeline with database configuration, a confidence scorer, and loads QA rules. The database configuration includes host, port, database name, user, and password. ```Python class QualityAssurancePipeline: def __init__(self): self.db_config = { 'host': 'localhost', 'port': 5433, 'database': 'pake_knowledge', 'user': 'pake_admin', 'password': 'pake_secure_2024' } self.confidence_scorer = ConfidenceScorer() self.qa_rules = self.load_qa_rules() ``` -------------------------------- ### Configure Custom API Port for PAKE Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/QUICK_START_AUTOMATION.md PowerShell commands to set a custom bridge port environment variable before starting the PAKE automation. ```PowerShell $env:BRIDGE_PORT = 3001 .\start_pake_automation.ps1 ``` -------------------------------- ### Initialize PAKE Database Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md This Python script initializes the PAKE system's database. It includes functions to wait for the database to become available, execute SQL files, verify the database schema (including checking for the 'vector' extension), and create sample data for testing purposes. It uses the `asyncpg` library for asynchronous PostgreSQL operations. ```Python import asyncio import asyncpg import logging import os from pathlib import Path logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) class DatabaseInitializer: def __init__(self): self.db_config = { 'host': 'localhost', 'port': 5433, 'database': 'pake_knowledge', 'user': 'pake_admin', 'password': 'pake_secure_2024' } async def wait_for_database(self, max_attempts=30): """Wait for database to be available""" for attempt in range(max_attempts): try: conn = await asyncpg.connect(**self.db_config) await conn.close() logger.info("✅ Database connection successful") return True except Exception as e: logger.info(f"Attempt {attempt + 1}/{max_attempts}: Waiting for database...") if attempt == max_attempts - 1: logger.error(f"❌ Database connection failed: {e}") return False await asyncio.sleep(2) return False async def run_sql_file(self, filepath): """Execute SQL file""" logger.info(f"Executing SQL file: {filepath}") try: with open(filepath, 'r') as f: sql_content = f.read() conn = await asyncpg.connect(**self.db_config) await conn.execute(sql_content) await conn.close() logger.info(f"✅ Successfully executed {filepath}") return True except Exception as e: logger.error(f"❌ Failed to execute {filepath}: {e}") return False async def verify_schema(self): """Verify database schema is properly initialized""" logger.info("Verifying database schema...") required_tables = [ 'knowledge_nodes', 'node_connections', 'processing_logs', 'confidence_history' ] try: conn = await asyncpg.connect(**self.db_config) for table in required_tables: result = await conn.fetchval( "SELECT COUNT(*) FROM information_schema.tables WHERE table_name = $1", table ) if result > 0: logger.info(f"✅ Table exists: {table}") else: logger.error(f"❌ Missing table: {table}") return False result = await conn.fetchval( "SELECT COUNT(*) FROM pg_extension WHERE extname = 'vector'" ) if result > 0: logger.info("✅ pgvector extension installed") else: logger.error("❌ pgvector extension not found") return False await conn.close() logger.info("✅ Database schema verification passed") return True except Exception as e: logger.error(f"❌ Schema verification failed: {e}") return False async def create_sample_data(self): """Create sample data for testing""" logger.info("Creating sample data...") sample_nodes = [ { 'content': 'PAKE+ System initialization successful. All components operational.', 'confidence_score': 1.0, 'type': 'system', 'verification_status': 'verified', 'source_uri': 'local://system' }, { 'content': 'Test knowledge node for validation of ingestion pipeline functionality.', 'confidence_score': 0.8, 'type': 'test', 'verification_status': 'verified', 'source_uri': 'local://test' } ] try: conn = await asyncpg.connect(**self.db_config) for node in sample_nodes: await conn.execute(""" INSERT INTO knowledge_nodes (content, confidence_score, type, verification_status, source_uri, tags) VALUES ($1, $2, $3, $4, $5, $6) """, node['content'], node['confidence_score'], node['type'], node['verification_status'], node['source_uri'], ['system', 'initialization'] ) await conn.close() logger.info("✅ Sample data created") return True except Exception as e: logger.error(f"❌ Failed to create sample data: {e}") return False ``` -------------------------------- ### Configure Custom Vault Path for PAKE Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/QUICK_START_AUTOMATION.md PowerShell commands to set a custom vault path environment variable before starting the PAKE automation. ```PowerShell # Set before starting $env:VAULT_PATH = "C:\MyCustomVault" .\start_pake_automation.ps1 ``` -------------------------------- ### Verify MCP Integration Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/GEMINI_CLI_SETUP_INSTRUCTIONS.md Lists the currently configured PAKE MCP servers to verify that they have been added correctly. ```bash gemini mcp list ``` -------------------------------- ### Reset PostgreSQL Password Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/rotate-secrets.md Steps to reset the PostgreSQL user password by starting only the PostgreSQL service, executing an ALTER USER command, and then stopping the service. ```bash cd D:\Projects\PAKE_SYSTEM\docker # Start only PostgreSQL to reset password docker-compose up -d postgres # Wait 10 seconds for startup timeout 10 # Reset password docker-compose exec postgres psql -U postgres -c "ALTER USER pake_user PASSWORD 'YOUR_NEW_DB_PASSWORD_HERE';" # Stop PostgreSQL docker-compose down ``` -------------------------------- ### Python Database Initialization Logic Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/COMPLETE_AUTOMATION_GUIDE.md This Python code defines the core logic for initializing a database. It includes asynchronous methods to wait for database availability, verify the database schema, and create sample data. Error handling is implemented for each step, logging failures and returning a boolean status. ```python import asyncio import logging logger = logging.getLogger(__name__) class DatabaseInitializer: async def wait_for_database(self): # Placeholder for waiting logic logger.info("⏳ Waiting for database...") await asyncio.sleep(1) # Simulate waiting return True async def verify_schema(self): # Placeholder for schema verification logger.info("🔍 Verifying database schema...") await asyncio.sleep(1) # Simulate verification return True async def create_sample_data(self): # Placeholder for sample data creation logger.info("➕ Creating sample data...") await asyncio.sleep(1) # Simulate data creation return True async def initialize(self): """Main initialization process""" logger.info("🗄️ Starting database initialization...") if not await self.wait_for_database(): return False if not await self.verify_schema(): logger.error("❌ Database schema verification failed") return False if not await self.create_sample_data(): logger.error("❌ Sample data creation failed") return False logger.info("✅ Database initialization completed successfully") return True async def main(): initializer = DatabaseInitializer() success = await initializer.initialize() exit(0 if success else 1) if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Bash Create PAKE System User and Directories Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/SECURITY-HARDENING.md Creates a dedicated system user for the PAKE system with no shell or home directory, and sets up the main application directory with appropriate ownership and permissions. ```Bash # Create pake system user (no shell, no home directory) sudo useradd --system --no-create-home --shell /bin/false pake-system # Create application directory sudo mkdir -p /opt/pake-system sudo chown pake-system:pake-system /opt/pake-system sudo chmod 750 /opt/pake-system ``` -------------------------------- ### Manage PAKE Windows Service Source: https://github.com/christaylorau23/pake-system/blob/feature/phase-3-ui-ux-modernization/startup_options.md Commands to manage the PAKE Windows service, including starting, stopping, removing, and checking its status. Requires administrator privileges for installation and management. ```Batch python pake_service.py start python pake_service.py stop python pake_service.py remove sc query PAKEAutomationService ```