TeckFire

Project Invictus config.fish

Mar 3rd, 2026
1,396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.07 KB | None | 0 0
  1. #Fish Script for Project Invictus
  2.  
  3. # Disable the "Service Management" logging for background spawns
  4. set -gx COM_APPLE_LOG_CONFIG_LEVEL 0
  5.  
  6. # Prevent every shell command from being recorded by the Apple Intelligence/Suggestd logic
  7. set -gx XPC_SERVICES_UNAVAILABLE 1
  8.  
  9. if status is-interactive
  10. # Commands to run in interactive sessions can go here
  11. end
  12. # 1. Force the fastest PATH (Bypass Cryptex and Search Storms)
  13. set -gx PATH /usr/bin /bin /usr/local/bin /usr/sbin /sbin
  14.  
  15. # 2. Disable Fish Greeting (Saves 5-10ms)
  16. set -g fish_greeting ""
  17.  
  18. # 3. Suppress the Linker "Closures" (Bypass corrupted OCLP maps)
  19. set -gx DYLD_USE_CLOSURES 0
  20.  
  21. # 4. Suppress the Security "Tax" for the current session
  22. set -gx DYLD_PRINT_WARNINGS 0
  23.  
  24. # 5. Accessibility/UI Snappiness: Silence WindowServer animations for child processes
  25. set -gx NSGL_DISABLE_QUARTZ 1
  26.  
  27. # Force standard validation but keep the path direct.
  28. # Removing DONT_VALIDATE actually reduces kernel_task overhead.
  29. set -gx DYLD_SHARED_CACHE_DIR /System/Volumes/Preboot/Cryptexes/OS/System/Library/dyld
  30. set -e DYLD_SHARED_CACHE_DONT_VALIDATE
  31.  
  32. # Use the 'Pure' or 'Hydro' prompt if you want speed,
  33. # or keep the default but disable git status in large repos
  34. #set -g __fish_git_prompt_show_informative_status 0
  35.  
  36. # --- Permanent Sleeper Context Prompt ---
  37. function fish_prompt
  38. # basename is a fast internal string split
  39. set -l last_folder (basename (prompt_pwd))
  40. echo -n (set_color blue)"$last_folder "(set_color green)'$ '(set_color normal)
  41. end
  42.  
  43. function fish_right_prompt
  44. # Explicitly disabled to stop the 1Hz/per-command clock/status wakeups
  45. end
  46.  
  47. # Sync your Priority Engine's Tier 2 environment
  48. set -x LC_ALL en_US.UTF-8
  49.  
  50. # Explicitly set colors as Global to avoid shadowing conflicts
  51. set -g fish_color_command 2ecc71 --bold
  52. set -g fish_color_param 3498db
  53. set -g fish_color_autosuggestion 7f8c8d
  54. set -g fish_color_error e74c3c
  55.  
  56. # Bridge to your Sleeper Script
  57. function boost
  58. set -l pid $fish_pid
  59. sudo renice -n -15 -p $pid
  60. echo (set_color green)"🚀 Fish Shell (PID: $pid) boosted to -15"(set_color normal)
  61. echo "Note: Sleeper Engine v7.6+ will respect this manual override."
  62. end
  63.  
  64. function sleeper-status
  65. echo (set_color -u cyan)"--- 🛡️ Sleeper v16 (Silent Sentinel Edition) ---"(set_color normal)
  66.  
  67. # 1. Load: Fast read
  68. load-check
  69.  
  70. echo "PID NICE COMMAND STATE"
  71. echo "------------------------------------------"
  72.  
  73. # Synchronized with silent_sentinel.sh Tiers 1-5
  74. # Using the same comm name logic for parity
  75. ps -ax -c -o pid=,ni=,state=,comm= | awk '
  76. /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/ {
  77. msg = ""
  78. col = "\033[0;37m" # Normal (Tier 3/Neutral)
  79.  
  80. # Tier 1 & 2: Priority Green
  81. if ($2 <= -10) {
  82. col = "\033[1;32m"
  83. }
  84. # Tier 4 & 5: Throttled Blue/Yellow
  85. else if ($2 >= 15) {
  86. col = "\033[0;33m"
  87. msg = "\033[0;34m[THROTTLED]\033[0m"
  88. }
  89.  
  90. # Frozen State Check
  91. if ($3 ~ /T/) msg = "\033[0;31m[FROZEN]\033[0m"
  92.  
  93. printf "%-7s %-6s %-25s %s\n", $1, col $2 "\033[0m", $4, msg
  94. }'
  95. end
  96.  
  97. # --- The Sleeper Manual Override Pair ---
  98.  
  99. function freeze
  100. echo (set_color red)"🧊 Manual Freeze (Bunker Mode) initiated..."(set_color normal)
  101. # Create the lock file so the daemon stays quiet
  102. sudo touch /tmp/sleeper_bunker_lock
  103.  
  104. set -l freeze_list contactsd OneDrive cloudd bird mdworker mdworker_shared suggestd mediaanalysisd photoanalysisd mdbulkimport intelligenceplatformd vmd triald analyticsd remoted syspolicyd
  105. set -l pattern (string join "|" $freeze_list)
  106. set -l pids (ps -ax -o pid= -o comm= | grep -Ei "$pattern" | awk '{print $1}')
  107.  
  108. if test -n "$pids"
  109. sudo kill -STOP $pids 2>/dev/null
  110. echo "✅ Suspended "(count $pids)" processes and locked Bunker."
  111. end
  112. end
  113.  
  114. function thaw
  115. echo (set_color cyan)"❄️ Manual Thaw initiated..."(set_color normal)
  116. # Remove the lock so the daemon can resume normal management
  117. sudo rm -f /tmp/sleeper_bunker_lock
  118.  
  119. set -l freeze_list contactsd OneDrive cloudd bird mdworker mdworker_shared suggestd mediaanalysisd photoanalysisd mdbulkimport intelligenceplatformd vmd triald analyticsd remoted syspolicyd
  120. set -l pattern (string join "|" $freeze_list)
  121. set -l pids (ps -ax -o pid= -o comm= | grep -Ei "$pattern" | awk '{print $1}')
  122.  
  123. if test -n "$pids"
  124. sudo kill -CONT $pids 2>/dev/null
  125. echo "✅ Resumed "(count $pids)" processes and unlocked daemon."
  126. end
  127. end
  128.  
  129.  
  130. function energy-hogs
  131. echo (set_color -o red)"--- ⚡ High-Impact Activity ---"(set_color normal)
  132.  
  133. # 1. Get the top processes
  134. # 2. sed -n '/PID/,$p' finds the line starting with PID and prints everything after it
  135. # 3. awk filters out the 0.0 idle noise but keeps the header
  136. top -l 1 -n 15 -o cpu -stats pid,command,cpu,state | sed -n '/PID/,$p' | awk '$3 > 0.0 || $2 == "COMMAND"'
  137.  
  138. echo ""
  139. echo (set_color cyan)"--- 🌡️ Thermal / System Pressure ---"(set_color normal)
  140.  
  141. # Check thermal throttling
  142. set -l therm_speed (pmset -g therm | grep "CPU_Speed_Limit" | awk '{print $NF}')
  143. if test -n "$therm_speed"
  144. set -l col (test "$therm_speed" = "100"; and echo green; or echo yellow)
  145. echo "CPU Speed Limit: "(set_color $col)"$therm_speed%"(set_color normal)
  146. else
  147. echo "CPU Speed Limit: "(set_color green)"100% (Nominal)"(set_color normal)
  148. end
  149.  
  150. # Memory check converted to MB (Integer)
  151. set -l free_pages (sysctl -n vm.page_free_count)
  152. set -l free_mb (math -s0 "($free_pages * 4096) / 1048576")
  153.  
  154. # Check how many processes are currently in the "Icebox"
  155. set -l frozen_count (ps -ax -o state | grep -c "T")
  156.  
  157. echo "Free Memory: $free_mb MB"
  158. echo "Icebox Status: "(set_color blue)"$frozen_count processes suspended"(set_color normal)
  159. end
  160.  
  161. function io-watch
  162. echo (set_color red)"--- 💾 Real-time Disk I/O (Press Ctrl+C to stop) ---"(set_color normal)
  163. # Filters out the shell and the command itself to show only background noise
  164. sudo fs_usage -w -f filesys | grep -vE "fs_usage|fish|grep"
  165. end
  166.  
  167. function sleeper-diagnose
  168. echo (set_color cyan)"--- 🧠 CPU C-State Residency Snapshot (Intel Ivy Bridge) ---"(set_color normal)
  169. # Use the cpu_power sampler for Intel chips
  170. # We take a 1-second sample (-i 1000) and look for C-states
  171. sudo powermetrics -n 1 -i 1000 -s cpu_power | grep -E "C-state|Residency|package"
  172. end
  173.  
  174. function load-check
  175. set -l load (sysctl -n vm.loadavg | string split " ")[2]
  176. # Extract just the number before the decimal for simple integer math
  177. set -l int_load (echo $load | cut -d. -f1)
  178. set -l col (set_color green)
  179.  
  180. if test $int_load -ge 2
  181. set col (set_color red)
  182. else if test $int_load -ge 1
  183. set col (set_color yellow)
  184. end
  185.  
  186. echo (set_color white)"Current Load Floor: "$col"$load"(set_color normal)
  187. end
  188.  
  189. function bunker-mode
  190. if test "$argv" = "on"
  191. sudo touch /tmp/sleeper_bunker_lock
  192. freeze
  193. echo (set_color red)"🔒 Bunker Lock active. Background daemon will not auto-thaw."(set_color normal)
  194. else if test "$argv" = "off"
  195. sudo rm -f /tmp/sleeper_bunker_lock
  196. thaw
  197. echo (set_color green)"🔓 Bunker Lock released."(set_color normal)
  198. else
  199. echo "Usage: bunker-mode [on|off]"
  200. if test -f /tmp/sleeper_bunker_lock
  201. echo "Current Status: "(set_color red)"LOCKED"(set_color normal)
  202. else
  203. echo "Current Status: "(set_color green)"UNLOCKED"(set_color normal)
  204. end
  205. end
  206. end
  207.  
Advertisement
Add Comment
Please, Sign In to add comment