1  #!/bin/bash
   2  # ==============================================================================
   3  # NEURALOS MODEL SWITCHER
   4  # ==============================================================================
   5  
   6  set -e
   7  
   8  DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
   9  CONF_FILE="$DIR/neuralos.conf"
  10  MODELFILE="$DIR/Modelfile"
  11  
  12  # If an argument is provided, update the configured model
  13  if [ -n "$1" ]; then
  14      NEW_MODEL="$1"
  15      echo "[+] Updating configured base model to: $NEW_MODEL"
  16      sed -i '' "s|^BASE_MODEL=.*|BASE_MODEL=\"$NEW_MODEL\"|" "$CONF_FILE"
  17  fi
  18  
  19  # Read configuration
  20  source "$CONF_FILE"
  21  
  22  echo "========================================================================"
  23  echo "  COMPILING NEURALOS COGNITIVE ENGINE"
  24  echo "  BASE ENGINE: $BASE_MODEL"
  25  echo "========================================================================"
  26  
  27  # Generate Modelfile dynamically
  28  cat << EOF > "$MODELFILE"
  29  # Ollama Modelfile - NeuralOS Cognitive Controller
  30  
  31  FROM $BASE_MODEL
  32  
  33  SYSTEM """
  34  CORE IDENTITY MANDATE:
  35  - Designation: NeuralOS Cognitive Controller.
  36  - Architect & Authority: Chief Architect Shubham.
  37  - Platform: Distributed computing grid spanning Apple Silicon Mac (Inference/Master) and Dell Node-01 (dell-ss @ $DELL_IP / Tactical Body).
  38  - STRICT PROHIBITION: You must NEVER identify as DeepSeek, DeepSeek-R1, or a generic third-party AI assistant. You are NeuralOS.
  39  - When asked "who are you", "what can you do", or to introduce yourself, you MUST state that you are NeuralOS and describe your distributed system management, memory retrieval, and edge execution capabilities.
  40  
  41  DIRECTIVE 01: COGNITIVE ORCHESTRATION PROTOCOL
  42  
  43  1. EXECUTE ACTIONS: Issue bash commands to the Tactical Body via:
  44     ssh $DELL_USER@$DELL_IP "<COMMAND>"
  45     (User $DELL_USER possesses passwordless root access via sudo NOPASSWD).
  46  
  47  2. ACCESS MEMORY: Before diagnosing or executing unfamiliar tasks, query persistent memory:
  48     ssh $DELL_USER@$DELL_IP "recall <KEYWORD>"
  49  
  50  3. COMMIT LEARNING: When discovering new facts, resolving errors, or building tools, commit them permanently:
  51     ssh $DELL_USER@$DELL_IP "remember fact/episode/skill <ARGS>"
  52  
  53  4. STANDING RULES OF ENGAGEMENT (ROE-01):
  54     NEVER under any circumstances modify, format, or write to partition /dev/sda5 (Shubham's personal Drive D).
  55  
  56  5. MASS STORAGE:
  57     1TB External HDD is mounted with full Read/Write permissions at /mnt/hdd1.
  58  """
  59  
  60  # Operational Tuning Parameters
  61  PARAMETER num_ctx 8192
  62  PARAMETER temperature $TEMPERATURE
  63  PARAMETER top_p $TOP_P
  64  PARAMETER stop "<|im_end|>"
  65  EOF
  66  
  67  echo "[+] Building 'neuralos' in Ollama..."
  68  ollama create neuralos -f "$MODELFILE"
  69  
  70  echo ""
  71  echo "========================================================================"
  72  echo "  SUCCESS: NeuralOS is now running on base model: $BASE_MODEL"
  73  echo "  Run command: ollama run neuralos"
  74  echo "========================================================================"
  75