#!/bin/sh # Inside The Machine: scan my machine (macOS and Linux). # READ-ONLY. It reads a few facts about this computer. It writes no files, # installs nothing and sends nothing. The only network call was the curl that # downloaded it. It prints one link. Open it, or paste it to your agent. SITE="https://insidethemachine.ai" has() { command -v "$1" >/dev/null 2>&1; } slug() { printf '%s' "$1" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9.' '-' | sed 's/^-//; s/-$//' | cut -c1-48; } RAM=""; CHIP=""; HW=""; GPU=""; VRAM=""; OSV="" if [ "$(uname -s)" = Darwin ]; then OS=mac; OSV="macos-$(sw_vers -productVersion)" RAM=$(( $(sysctl -n hw.memsize) / 1073741824 )) CHIP=$(sysctl -n machdep.cpu.brand_string 2>/dev/null) HW=$(system_profiler SPHardwareDataType 2>/dev/null | awk -F': ' '/Model Name/{print $2; exit}') case "$CHIP" in Apple*) GPU="$CHIP"; VRAM="$RAM";; esac # Apple chips share one memory else OS=linux # shellcheck disable=SC1091 OSV=$(. /etc/os-release 2>/dev/null; echo "${ID:-linux}-${VERSION_ID:-}") RAM=$(awk '/^MemTotal:/{printf "%d", $2/1048576 + 0.5}' /proc/meminfo) CHIP=$(awk -F': ' '/^model name/{print $2; exit}' /proc/cpuinfo) [ -n "$CHIP" ] || CHIP=$(uname -m) if has nvidia-smi; then GPU=$(nvidia-smi --query-gpu=name --format=csv,noheader 2>/dev/null | head -n 1) VRAM=$(nvidia-smi --query-gpu=memory.total --format=csv,noheader,nounits 2>/dev/null | awk 'NR==1{printf "%d", $1/1024 + 0.5}') else for f in /sys/class/drm/card*/device/mem_info_vram_total; do [ -r "$f" ] && VRAM=$(awk '{printf "%d", $1/1073741824 + 0.5}' "$f") && break done has lspci && GPU=$(lspci 2>/dev/null | awk -F': ' '/VGA|3D|Display/{print $2; exit}') fi fi DISK=$(df -Pk "$HOME" 2>/dev/null | awk 'NR==2{printf "%d", $4/1048576}') APPS="" add() { APPS="${APPS:+$APPS,}$1"; } if has ollama || [ -d /Applications/Ollama.app ]; then add ollama; fi if has lms || [ -d "/Applications/LM Studio.app" ] || [ -d "$HOME/.lmstudio" ]; then add lm-studio; fi if has llama-server || has llama-cli || has llama; then add llama-cpp; fi if has mlx_lm.generate || [ -d "$HOME/.venvs/mlx" ]; then add mlx-lm; fi if has open-webui || [ -d "$HOME/.venvs/openwebui" ]; then add open-webui; fi if has jan || [ -d /Applications/Jan.app ]; then add jan; fi if has vllm; then add vllm; fi if has whisper-cli || [ -d "$HOME/whisper.cpp" ]; then add whisper-cpp; fi if has aider; then add aider; fi if has opencode; then add opencode; fi if has hermes; then add hermes-agent; fi if [ -d "/Applications/Draw Things.app" ]; then add draw-things; fi if [ -d /Applications/ComfyUI.app ] || [ -d "$HOME/ComfyUI" ]; then add comfyui; fi if has docker; then add docker; fi Q="ram=$RAM&os=$OS&osv=$(slug "$OSV")&chip=$(slug "$CHIP")" [ -n "$HW" ] && Q="$Q&hw=$(slug "$HW")" [ -n "$GPU" ] && Q="$Q&gpu=$(slug "$GPU")" [ -n "$VRAM" ] && Q="$Q&vram=$VRAM" [ -n "$DISK" ] && Q="$Q&disk=$DISK" [ -n "$APPS" ] && Q="$Q&apps=$APPS" echo "Memory: ${RAM} GB" echo "Chip: ${CHIP:-unknown} ${HW:+($HW)}" echo "Graphics: ${GPU:-none found}${VRAM:+, $VRAM GB}" echo "System: $OSV, ${DISK:-?} GB free" echo "AI apps: ${APPS:-none found}" echo echo "Your setup: $SITE/my?$Q" echo "For agents: $SITE/my.json?$Q"