Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Fish Script for Project Invictus
- # Disable the "Service Management" logging for background spawns
- set -gx COM_APPLE_LOG_CONFIG_LEVEL 0
- # Prevent every shell command from being recorded by the Apple Intelligence/Suggestd logic
- set -gx XPC_SERVICES_UNAVAILABLE 1
- if status is-interactive
- # Commands to run in interactive sessions can go here
- end
- # 1. Force the fastest PATH (Bypass Cryptex and Search Storms)
- set -gx PATH /usr/bin /bin /usr/local/bin /usr/sbin /sbin
- # 2. Disable Fish Greeting (Saves 5-10ms)
- set -g fish_greeting ""
- # 3. Suppress the Linker "Closures" (Bypass corrupted OCLP maps)
- set -gx DYLD_USE_CLOSURES 0
- # 4. Suppress the Security "Tax" for the current session
- set -gx DYLD_PRINT_WARNINGS 0
- # 5. Accessibility/UI Snappiness: Silence WindowServer animations for child processes
- set -gx NSGL_DISABLE_QUARTZ 1
- # Force standard validation but keep the path direct.
- # Removing DONT_VALIDATE actually reduces kernel_task overhead.
- set -gx DYLD_SHARED_CACHE_DIR /System/Volumes/Preboot/Cryptexes/OS/System/Library/dyld
- set -e DYLD_SHARED_CACHE_DONT_VALIDATE
- # Use the 'Pure' or 'Hydro' prompt if you want speed,
- # or keep the default but disable git status in large repos
- #set -g __fish_git_prompt_show_informative_status 0
- # --- Permanent Sleeper Context Prompt ---
- function fish_prompt
- # basename is a fast internal string split
- set -l last_folder (basename (prompt_pwd))
- echo -n (set_color blue)"$last_folder "(set_color green)'$ '(set_color normal)
- end
- function fish_right_prompt
- # Explicitly disabled to stop the 1Hz/per-command clock/status wakeups
- end
- # Sync your Priority Engine's Tier 2 environment
- set -x LC_ALL en_US.UTF-8
- # Explicitly set colors as Global to avoid shadowing conflicts
- set -g fish_color_command 2ecc71 --bold
- set -g fish_color_param 3498db
- set -g fish_color_autosuggestion 7f8c8d
- set -g fish_color_error e74c3c
- # Bridge to your Sleeper Script
- function boost
- set -l pid $fish_pid
- sudo renice -n -15 -p $pid
- echo (set_color green)"🚀 Fish Shell (PID: $pid) boosted to -15"(set_color normal)
- echo "Note: Sleeper Engine v7.6+ will respect this manual override."
- end
- function sleeper-status
- echo (set_color -u cyan)"--- 🛡️ Sleeper v16 (Silent Sentinel Edition) ---"(set_color normal)
- # 1. Load: Fast read
- load-check
- echo "PID NICE COMMAND STATE"
- echo "------------------------------------------"
- # Synchronized with silent_sentinel.sh Tiers 1-5
- # Using the same comm name logic for parity
- ps -ax -c -o pid=,ni=,state=,comm= | awk '
- /hidd|WindowServer|SkyLight|bluetoothd|coreaudiod|powerd|thermalmonitord|mediaremoted|Alfred|Terminal|DynamicLake|WindowManager|Dock|Finder|Swish|Helium|logd|AlDente|ControlCenter|mds|configd|identityservicesd|trustd|itunescloudd|OneDrive|bird|cloudd|backupd|dasd|CoreSimulator|mediaanalysisd|photoanalysisd|suggestd|intelligenceplatformd|triald|parsec|analyticsd|vmd|siriknowledged|symptomsd|remoted|syspolicyd|biomesyncd/ {
- msg = ""
- col = "\033[0;37m" # Normal (Tier 3/Neutral)
- # Tier 1 & 2: Priority Green
- if ($2 <= -10) {
- col = "\033[1;32m"
- }
- # Tier 4 & 5: Throttled Blue/Yellow
- else if ($2 >= 15) {
- col = "\033[0;33m"
- msg = "\033[0;34m[THROTTLED]\033[0m"
- }
- # Frozen State Check
- if ($3 ~ /T/) msg = "\033[0;31m[FROZEN]\033[0m"
- printf "%-7s %-6s %-25s %s\n", $1, col $2 "\033[0m", $4, msg
- }'
- end
- # --- The Sleeper Manual Override Pair ---
- function freeze
- echo (set_color red)"🧊 Manual Freeze (Bunker Mode) initiated..."(set_color normal)
- # Create the lock file so the daemon stays quiet
- sudo touch /tmp/sleeper_bunker_lock
- set -l freeze_list contactsd OneDrive cloudd bird mdworker mdworker_shared suggestd mediaanalysisd photoanalysisd mdbulkimport intelligenceplatformd vmd triald analyticsd remoted syspolicyd
- set -l pattern (string join "|" $freeze_list)
- set -l pids (ps -ax -o pid= -o comm= | grep -Ei "$pattern" | awk '{print $1}')
- if test -n "$pids"
- sudo kill -STOP $pids 2>/dev/null
- echo "✅ Suspended "(count $pids)" processes and locked Bunker."
- end
- end
- function thaw
- echo (set_color cyan)"❄️ Manual Thaw initiated..."(set_color normal)
- # Remove the lock so the daemon can resume normal management
- sudo rm -f /tmp/sleeper_bunker_lock
- set -l freeze_list contactsd OneDrive cloudd bird mdworker mdworker_shared suggestd mediaanalysisd photoanalysisd mdbulkimport intelligenceplatformd vmd triald analyticsd remoted syspolicyd
- set -l pattern (string join "|" $freeze_list)
- set -l pids (ps -ax -o pid= -o comm= | grep -Ei "$pattern" | awk '{print $1}')
- if test -n "$pids"
- sudo kill -CONT $pids 2>/dev/null
- echo "✅ Resumed "(count $pids)" processes and unlocked daemon."
- end
- end
- function energy-hogs
- echo (set_color -o red)"--- ⚡ High-Impact Activity ---"(set_color normal)
- # 1. Get the top processes
- # 2. sed -n '/PID/,$p' finds the line starting with PID and prints everything after it
- # 3. awk filters out the 0.0 idle noise but keeps the header
- top -l 1 -n 15 -o cpu -stats pid,command,cpu,state | sed -n '/PID/,$p' | awk '$3 > 0.0 || $2 == "COMMAND"'
- echo ""
- echo (set_color cyan)"--- 🌡️ Thermal / System Pressure ---"(set_color normal)
- # Check thermal throttling
- set -l therm_speed (pmset -g therm | grep "CPU_Speed_Limit" | awk '{print $NF}')
- if test -n "$therm_speed"
- set -l col (test "$therm_speed" = "100"; and echo green; or echo yellow)
- echo "CPU Speed Limit: "(set_color $col)"$therm_speed%"(set_color normal)
- else
- echo "CPU Speed Limit: "(set_color green)"100% (Nominal)"(set_color normal)
- end
- # Memory check converted to MB (Integer)
- set -l free_pages (sysctl -n vm.page_free_count)
- set -l free_mb (math -s0 "($free_pages * 4096) / 1048576")
- # Check how many processes are currently in the "Icebox"
- set -l frozen_count (ps -ax -o state | grep -c "T")
- echo "Free Memory: $free_mb MB"
- echo "Icebox Status: "(set_color blue)"$frozen_count processes suspended"(set_color normal)
- end
- function io-watch
- echo (set_color red)"--- 💾 Real-time Disk I/O (Press Ctrl+C to stop) ---"(set_color normal)
- # Filters out the shell and the command itself to show only background noise
- sudo fs_usage -w -f filesys | grep -vE "fs_usage|fish|grep"
- end
- function sleeper-diagnose
- echo (set_color cyan)"--- 🧠 CPU C-State Residency Snapshot (Intel Ivy Bridge) ---"(set_color normal)
- # Use the cpu_power sampler for Intel chips
- # We take a 1-second sample (-i 1000) and look for C-states
- sudo powermetrics -n 1 -i 1000 -s cpu_power | grep -E "C-state|Residency|package"
- end
- function load-check
- set -l load (sysctl -n vm.loadavg | string split " ")[2]
- # Extract just the number before the decimal for simple integer math
- set -l int_load (echo $load | cut -d. -f1)
- set -l col (set_color green)
- if test $int_load -ge 2
- set col (set_color red)
- else if test $int_load -ge 1
- set col (set_color yellow)
- end
- echo (set_color white)"Current Load Floor: "$col"$load"(set_color normal)
- end
- function bunker-mode
- if test "$argv" = "on"
- sudo touch /tmp/sleeper_bunker_lock
- freeze
- echo (set_color red)"🔒 Bunker Lock active. Background daemon will not auto-thaw."(set_color normal)
- else if test "$argv" = "off"
- sudo rm -f /tmp/sleeper_bunker_lock
- thaw
- echo (set_color green)"🔓 Bunker Lock released."(set_color normal)
- else
- echo "Usage: bunker-mode [on|off]"
- if test -f /tmp/sleeper_bunker_lock
- echo "Current Status: "(set_color red)"LOCKED"(set_color normal)
- else
- echo "Current Status: "(set_color green)"UNLOCKED"(set_color normal)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment