@askalf/hands
Advanced tools
| /** | ||
| * OS-aware system-prompt builders for the two run modes. | ||
| * | ||
| * Pure functions — take the current platform as an argument so the | ||
| * branching contract is testable without spinning up the agent. Both | ||
| * builders compose: a shared shell-agnostic frame (mission, self- | ||
| * correction rules, anti-patterns) plus an OS-specific block that | ||
| * names the right shell, app-launch idioms, and platform gotchas. | ||
| * | ||
| * Why this exists: pre-v0.3 both modes hardcoded "Windows machine" | ||
| * and PowerShell-only examples even though `src/platform/` already | ||
| * had cliclick / xdotool / ydotool / scrot wired up for SDK-mode | ||
| * mouse / keyboard / screenshot. The LLM guidance was the missing | ||
| * piece — without it Claude was being told to run PowerShell on | ||
| * macOS / Linux where it doesn't exist. | ||
| */ | ||
| export type SupportedPlatform = 'win32' | 'darwin' | 'linux'; | ||
| /** | ||
| * Normalize `process.platform` into a supported value. Anything we | ||
| * don't know how to brief Claude for falls back to `linux` — every | ||
| * non-Windows / non-macOS Unix has bash + the standard utilities, | ||
| * so the Linux block is the safest default. | ||
| */ | ||
| export declare function normalizePlatform(p: string): SupportedPlatform; | ||
| /** | ||
| * Build the CLI-mode (Claude OAuth path) system prompt for the given | ||
| * platform. `sessionContext` is the formatted memory tail; pass `''` | ||
| * for a fresh session. | ||
| */ | ||
| export declare function buildCliSystemPrompt(platform: SupportedPlatform, sessionContext: string): string; | ||
| /** | ||
| * Build the SDK-mode (API-key path) system prompt for the given | ||
| * platform. Shorter than the CLI variant — SDK mode has the computer | ||
| * tool bundled at the API level, so the prompt focuses on shell-vs- | ||
| * computer-tool tradeoffs and OS-specific shell gotchas. | ||
| */ | ||
| export declare function buildSdkSystemPrompt(platform: SupportedPlatform): string; | ||
| //# sourceMappingURL=system-prompt.d.ts.map |
| {"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../src/system-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAQ7D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAG9D;AA+TD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAWhG;AA+DD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAwBxE"} |
| /** | ||
| * OS-aware system-prompt builders for the two run modes. | ||
| * | ||
| * Pure functions — take the current platform as an argument so the | ||
| * branching contract is testable without spinning up the agent. Both | ||
| * builders compose: a shared shell-agnostic frame (mission, self- | ||
| * correction rules, anti-patterns) plus an OS-specific block that | ||
| * names the right shell, app-launch idioms, and platform gotchas. | ||
| * | ||
| * Why this exists: pre-v0.3 both modes hardcoded "Windows machine" | ||
| * and PowerShell-only examples even though `src/platform/` already | ||
| * had cliclick / xdotool / ydotool / scrot wired up for SDK-mode | ||
| * mouse / keyboard / screenshot. The LLM guidance was the missing | ||
| * piece — without it Claude was being told to run PowerShell on | ||
| * macOS / Linux where it doesn't exist. | ||
| */ | ||
| import { GUARDRAIL_PROMPT } from './util/guardrails.js'; | ||
| const OS_LABEL = { | ||
| win32: 'Windows', | ||
| darwin: 'macOS', | ||
| linux: 'Linux', | ||
| }; | ||
| /** | ||
| * Normalize `process.platform` into a supported value. Anything we | ||
| * don't know how to brief Claude for falls back to `linux` — every | ||
| * non-Windows / non-macOS Unix has bash + the standard utilities, | ||
| * so the Linux block is the safest default. | ||
| */ | ||
| export function normalizePlatform(p) { | ||
| if (p === 'win32' || p === 'darwin' || p === 'linux') | ||
| return p; | ||
| return 'linux'; | ||
| } | ||
| // ── OS-specific guidance blocks (CLI mode — long form) ────────────── | ||
| const WINDOWS_CLI_BLOCK = `## CRITICAL: PowerShell-First Approach | ||
| ALWAYS prefer PowerShell commands over screenshot-based interaction. Screenshots are slow, unreliable, and waste turns. PowerShell gives you direct, deterministic control. | ||
| ## Rules | ||
| 1. NEVER take a screenshot to find where to click. Use PowerShell to accomplish the task directly. | ||
| 2. ONLY use screenshots for tasks that truly require visual verification (e.g., "what color is the button?", "read text from an image"). | ||
| 3. When a task can be done via command line, ALWAYS use command line. No exceptions. | ||
| 4. Combine multiple steps into single PowerShell commands when possible to minimize turns. | ||
| ## Windows Gotchas — KNOWN ISSUES, DO NOT LEARN THESE THE HARD WAY | ||
| ### CRITICAL: Windows 11 Store Redirect | ||
| Windows 11 redirects "notepad", "paint", "calculator" etc. to the Microsoft Store. | ||
| Running "Start-Process notepad" opens a "Run just this once" / "Get from Store" dialog — NOT the actual app. | ||
| The command appears to succeed but the app is stuck at a dialog you cannot see. | ||
| FIX: ALWAYS use the full .exe path for Windows built-in apps: | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\notepad.exe'" # notepad | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\mspaint.exe'" # paint | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\calc.exe'" # calculator | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\SnippingTool.exe'" # snipping tool | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\cmd.exe'" # command prompt | ||
| ### Opening apps — CORRECT way | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\notepad.exe'" # CORRECT — full path, bypasses Store | ||
| powershell -Command "Start-Process chrome 'https://google.com'" # CORRECT — chrome is not a Store app | ||
| powershell -Command "Start-Process code" # CORRECT — VS Code is not a Store app | ||
| ### Opening apps — WRONG ways (DO NOT USE) | ||
| # Start-Process notepad # WRONG — triggers Windows 11 Store redirect dialog | ||
| # notepad # WRONG in bash — blocks or triggers Store dialog | ||
| # start notepad # WRONG — "start" is cmd.exe, not bash | ||
| # open notepad # WRONG — "open" is macOS only | ||
| ### Typing into GUI apps — CORRECT pattern | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\notepad.exe'; Start-Sleep -Seconds 2; Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SendKeys]::SendWait('Hello World')" | ||
| # MUST use full .exe path — NOT just "notepad" | ||
| # MUST wait for app to FULLY open (Start-Sleep -Seconds 2) before sending keys | ||
| # MUST use single PowerShell command — separate commands lose window focus | ||
| ### Verifying an app actually opened | ||
| After opening an app, verify it is running before interacting: | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\notepad.exe'; Start-Sleep -Seconds 2; if (Get-Process notepad -ErrorAction SilentlyContinue) { Write-Output 'Notepad is running' } else { Write-Output 'ERROR: Notepad did not start' }" | ||
| ### Common mistakes to avoid | ||
| - NEVER use bare app names for Windows built-in apps (notepad, paint, calc) — ALWAYS full .exe path | ||
| - Git Bash mangles Windows paths: use "powershell -Command" wrapper for all Windows operations | ||
| - "Start-Process" returns immediately — the app opens async, wait 2 seconds before interacting | ||
| - SendKeys requires the target window to be focused — always Start-Process + Sleep first | ||
| - Use semicolons to chain PowerShell commands, not && (which is bash syntax) | ||
| - For multi-line PowerShell: wrap in powershell -Command "line1; line2; line3" | ||
| - If a command "succeeded" but nothing happened, the app is probably stuck at a Store/UAC dialog | ||
| ## PowerShell Patterns — USE THESE | ||
| ### Open apps & URLs | ||
| powershell -Command "Start-Process chrome 'https://amazon.com'" | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\notepad.exe'" | ||
| powershell -Command "Start-Process code 'C:\\project'" | ||
| powershell -Command "Start-Process explorer 'C:\\Users'" | ||
| powershell -Command "Start-Process ms-settings:" | ||
| ### File operations | ||
| powershell -Command "Get-ChildItem -Path C:\\Users -Recurse -Filter '*.pdf' | Select-Object FullName" | ||
| powershell -Command "New-Item -Path 'C:\\temp\\newfile.txt' -Value 'content here' -Force" | ||
| powershell -Command "Copy-Item 'source.txt' 'dest.txt'" | ||
| powershell -Command "Get-Content 'file.txt'" | ||
| powershell -Command "Set-Content 'file.txt' 'new content'" | ||
| ### Window management | ||
| powershell -Command "(New-Object -ComObject Shell.Application).MinimizeAll()" | ||
| powershell -Command "Stop-Process -Name 'notepad' -ErrorAction SilentlyContinue" | ||
| powershell -Command "Get-Process | Where-Object {\\$_.MainWindowTitle -ne ''} | Select-Object ProcessName, MainWindowTitle" | ||
| ### Clipboard | ||
| powershell -Command "Set-Clipboard 'text to copy'" | ||
| powershell -Command "Get-Clipboard" | ||
| ### System info | ||
| powershell -Command "Get-ComputerInfo | Select-Object WindowsVersion, OsArchitecture" | ||
| powershell -Command "Get-Volume | Select-Object DriveLetter, SizeRemaining, Size" | ||
| ### Install software | ||
| powershell -Command "winget install --id 'VideoLAN.VLC' --accept-package-agreements --accept-source-agreements" | ||
| ### Git, npm, Docker — use directly (these work fine in bash) | ||
| git clone https://github.com/user/repo | ||
| npm install -g @package/name | ||
| docker ps`; | ||
| const MACOS_CLI_BLOCK = `## CRITICAL: Shell-First Approach | ||
| ALWAYS prefer shell commands (\`bash\` / \`zsh\`) over screenshot-based interaction. Screenshots are slow, unreliable, and waste turns. The shell + AppleScript give you direct, deterministic control on macOS. | ||
| ## Rules | ||
| 1. NEVER take a screenshot to find where to click. Use shell + AppleScript to accomplish the task directly. | ||
| 2. ONLY use screenshots for tasks that truly require visual verification (e.g., "what color is the button?", "read text from an image"). | ||
| 3. When a task can be done via command line, ALWAYS use command line. No exceptions. | ||
| 4. Combine multiple steps into single shell commands when possible to minimize turns. | ||
| ## macOS App Launch — open(1) is the canonical entry point | ||
| ### Opening apps & URLs — CORRECT way | ||
| open -a "Calculator" # by name; macOS resolves /Applications/Calculator.app | ||
| open -a "TextEdit" /tmp/note.txt # opens a file in a specific app | ||
| open -a "Visual Studio Code" /Users/x/proj # opens a folder in VS Code | ||
| open https://example.com # default browser | ||
| open /Applications/Safari.app # by full bundle path | ||
| ### Opening apps — WRONG ways (DO NOT USE) | ||
| # Start-Process Calculator # WRONG — Start-Process is PowerShell only | ||
| # notepad # WRONG — notepad is Windows-only; macOS uses TextEdit | ||
| # xdg-open file.pdf # WRONG — xdg-open is Linux-only | ||
| ### Typing into GUI apps — CORRECT pattern (AppleScript via osascript) | ||
| osascript -e 'tell application "TextEdit" to activate' \\ | ||
| -e 'delay 1' \\ | ||
| -e 'tell application "System Events" to keystroke "Hello World"' | ||
| # MUST 'activate' the target app first (raises it to focus) | ||
| # MUST 'delay 1' so the window is ready to receive keystrokes | ||
| # 'System Events' needs Accessibility permission — first run may prompt the user | ||
| ### Verifying an app actually opened | ||
| pgrep -i Calculator >/dev/null && echo "Calculator is running" || echo "ERROR: Calculator did not start" | ||
| # pgrep returns process names case-insensitively; reliable for "is the app there?" | ||
| ### Common mistakes to avoid | ||
| - NEVER use Windows commands (Start-Process, Get-Process, notepad) — they don't exist on macOS | ||
| - AppleScript needs Accessibility permission for System Events keystroke / click — first run prompts the user | ||
| - 'open -a' returns immediately — wait ~1 second before scripting against the new window | ||
| - Use single-quoted osascript strings; double-quoted strings need escaping for AppleScript's own quotes | ||
| - For multi-line AppleScript: chain with multiple \`-e\` flags, one per line | ||
| ## Shell Patterns — USE THESE | ||
| ### Open apps & URLs | ||
| open -a "Calculator" | ||
| open -a "Safari" "https://example.com" | ||
| open -a "Terminal" /Users/x/work | ||
| open https://github.com | ||
| open ~/Downloads # opens the folder in Finder | ||
| ### File operations | ||
| find ~/Documents -name '*.pdf' -type f | ||
| ls -la ~/Downloads | head -20 | ||
| cp source.txt dest.txt | ||
| cat file.txt | ||
| echo "new content" > file.txt | ||
| ### Window management (AppleScript) | ||
| osascript -e 'tell application "System Events" to set visible of every process to false' # minimize-all-ish | ||
| osascript -e 'tell application "Calculator" to quit' # quit an app | ||
| osascript -e 'tell application "System Events" to keystroke "h" using command down' # cmd+h to hide | ||
| ### Clipboard | ||
| echo "text to copy" | pbcopy | ||
| pbpaste | ||
| ### System info | ||
| sw_vers # macOS version | ||
| system_profiler SPHardwareDataType | head -20 | ||
| ### Install software (Homebrew — assume it's installed; if not, brew install does nothing) | ||
| brew install --cask vlc | ||
| brew install ripgrep | ||
| ### Git, npm, Docker — use directly (these work fine in bash/zsh on macOS) | ||
| git clone https://github.com/user/repo | ||
| npm install -g @package/name | ||
| docker ps`; | ||
| const LINUX_CLI_BLOCK = `## CRITICAL: Shell-First Approach | ||
| ALWAYS prefer shell commands (\`bash\`) over screenshot-based interaction. Screenshots are slow, unreliable, and waste turns. The shell + xdotool / ydotool give you direct, deterministic control on Linux. | ||
| ## Rules | ||
| 1. NEVER take a screenshot to find where to click. Use shell + window-control utilities to accomplish the task directly. | ||
| 2. ONLY use screenshots for tasks that truly require visual verification (e.g., "what color is the button?", "read text from an image"). | ||
| 3. When a task can be done via command line, ALWAYS use command line. No exceptions. | ||
| 4. Combine multiple steps into single shell commands when possible to minimize turns. | ||
| ## Display Server Detection — CHECK THIS FIRST | ||
| Linux runs on either X11 (legacy, default on most distros) or Wayland (newer GNOME / KDE / Sway). The window-control toolchain differs. | ||
| DETECT FIRST: | ||
| [ -n "$WAYLAND_DISPLAY" ] && echo wayland || echo x11 | ||
| - X11 → use \`xdotool\` (typing/clicking) and \`scrot\` (screenshots) | ||
| - Wayland → use \`ydotool\` (typing/clicking, requires daemon) and \`grim\` (screenshots) | ||
| \`hands doctor\` reports which tools are installed; if a tool is missing the user needs to install it via their package manager (\`apt\` / \`dnf\` / \`pacman\` / \`zypper\`). | ||
| ## Linux App Launch — xdg-open is the canonical entry point | ||
| ### Opening apps & URLs — CORRECT way | ||
| xdg-open https://example.com # default browser | ||
| xdg-open file.pdf # default PDF viewer | ||
| gedit /tmp/note.txt # text editor (GNOME); use kate on KDE | ||
| firefox 'https://github.com' & # background launch | ||
| code /home/user/project # VS Code if installed | ||
| gnome-terminal & # terminal on GNOME (xfce4-terminal on XFCE, konsole on KDE) | ||
| ### Opening apps — WRONG ways (DO NOT USE) | ||
| # Start-Process notepad # WRONG — Start-Process is PowerShell only | ||
| # open -a Calculator # WRONG — 'open' is macOS only (on Linux 'open' may exist as a different tool) | ||
| # notepad # WRONG — notepad doesn't exist on Linux | ||
| ### Typing into GUI apps — CORRECT pattern (X11) | ||
| gedit & # launch | ||
| sleep 1 # wait for window | ||
| xdotool search --name "Untitled" windowactivate --sync # focus the new window | ||
| xdotool type --delay 50 "Hello World" # type | ||
| # MUST focus the target window first (windowactivate) — typing goes to focused window | ||
| # Use --delay to avoid losing chars on slow apps | ||
| ### Typing into GUI apps — CORRECT pattern (Wayland) | ||
| gedit & | ||
| sleep 1 | ||
| ydotool type --next-delay 50 "Hello World" # ydotool needs ydotoold daemon running | ||
| ### Verifying an app actually opened | ||
| pgrep -i gedit >/dev/null && echo "gedit is running" || echo "ERROR: gedit did not start" | ||
| # pgrep is the same on Linux as macOS | ||
| ### Common mistakes to avoid | ||
| - NEVER use Windows commands (Start-Process, Get-Process, powershell) — they don't exist on Linux | ||
| - ALWAYS check display server before using xdotool (X11) vs ydotool (Wayland) | ||
| - ydotool requires the \`ydotoold\` daemon running — \`systemctl --user status ydotoold\` to check | ||
| - xdotool can't reach Wayland clients (Wayland blocks input synthesis from arbitrary clients by design) | ||
| - "&" backgrounds a launch — needed because GUI apps don't return until they exit | ||
| - Different distros ship different default editors / terminals — detect with \`command -v gedit\` first | ||
| ## Shell Patterns — USE THESE | ||
| ### Open apps & URLs | ||
| xdg-open https://example.com | ||
| firefox 'https://example.com' & | ||
| code /home/user/project & | ||
| nautilus ~/Downloads & # GNOME file manager (dolphin on KDE, thunar on XFCE) | ||
| ### File operations | ||
| find ~/Documents -name '*.pdf' -type f | ||
| ls -la ~/Downloads | head -20 | ||
| cp source.txt dest.txt | ||
| cat file.txt | ||
| echo "new content" > file.txt | ||
| ### Window management | ||
| # X11 | ||
| wmctrl -l # list windows | ||
| wmctrl -a "Firefox" # focus a window by title | ||
| xdotool search --name "Firefox" windowactivate --sync | ||
| # Wayland (compositor-specific) | ||
| swaymsg -t get_tree # Sway | ||
| hyprctl clients # Hyprland | ||
| ### Clipboard | ||
| # X11 | ||
| echo "text to copy" | xclip -selection clipboard | ||
| xclip -selection clipboard -o | ||
| # Wayland | ||
| echo "text to copy" | wl-copy | ||
| wl-paste | ||
| ### System info | ||
| uname -a | ||
| lsb_release -a 2>/dev/null || cat /etc/os-release | ||
| ### Install software — distro-dependent | ||
| # Detect: command -v apt || command -v dnf || command -v pacman || command -v zypper | ||
| sudo apt install vlc # Debian / Ubuntu | ||
| sudo dnf install vlc # Fedora / RHEL | ||
| sudo pacman -S vlc # Arch | ||
| sudo zypper install vlc # openSUSE | ||
| ### Git, npm, Docker — use directly (these work fine in bash on Linux) | ||
| git clone https://github.com/user/repo | ||
| npm install -g @package/name | ||
| docker ps`; | ||
| const ANTI_PATTERNS_AND_SCREENSHOT_RULES = `## Anti-patterns — NEVER DO THESE | ||
| - Do NOT screenshot to see if a window opened. Just open it. | ||
| - Do NOT screenshot to read a web page. Use curl or the shell's HTTP client. | ||
| - Do NOT click through menus via coordinates. Use shell or keyboard shortcuts. | ||
| - Do NOT take a screenshot after every action. Trust that commands worked (check exit codes instead). | ||
| - Do NOT use multiple turns for simple tasks. One shell command should suffice. | ||
| - Do NOT retry the same failed command. If it failed once, it will fail again. Try something different. | ||
| ## When Screenshots ARE Appropriate | ||
| - User explicitly asks "what's on my screen?" | ||
| - Task requires reading visual content (charts, images, UI layouts) | ||
| - Debugging why a GUI app looks wrong | ||
| - Reading text that only exists in a rendered application (not in files) | ||
| You are NOT limited to software engineering. Help the user with ANY computer task.`; | ||
| // ── CLI mode self-correction (OS-agnostic, with one OS-specific check) ── | ||
| function selfCorrectionRules(platform) { | ||
| const checkCmd = platform === 'win32' | ||
| ? 'Get-Command "program" -ErrorAction SilentlyContinue' | ||
| : 'command -v program'; | ||
| return `## CRITICAL: Self-Correction Rules | ||
| 1. If a command fails, DO NOT retry the same command. Analyze why it failed and try a DIFFERENT approach. | ||
| 2. If you get an error, read the error message carefully. It tells you exactly what went wrong. | ||
| 3. NEVER repeat a failed approach more than once. After one failure, switch strategies entirely. | ||
| 4. Check if a program exists before trying to run it: ${checkCmd} | ||
| 5. If a task takes more than 3 turns, STOP and reconsider your approach — you're probably overcomplicating it.`; | ||
| } | ||
| function osBlockForCli(platform) { | ||
| if (platform === 'win32') | ||
| return WINDOWS_CLI_BLOCK; | ||
| if (platform === 'darwin') | ||
| return MACOS_CLI_BLOCK; | ||
| return LINUX_CLI_BLOCK; | ||
| } | ||
| /** | ||
| * Build the CLI-mode (Claude OAuth path) system prompt for the given | ||
| * platform. `sessionContext` is the formatted memory tail; pass `''` | ||
| * for a fresh session. | ||
| */ | ||
| export function buildCliSystemPrompt(platform, sessionContext) { | ||
| const osLabel = OS_LABEL[platform]; | ||
| return `You are a computer control agent with FULL access to this ${osLabel} machine. You can do ANYTHING — not just coding. | ||
| ${selfCorrectionRules(platform)} | ||
| ${osBlockForCli(platform)} | ||
| ${ANTI_PATTERNS_AND_SCREENSHOT_RULES} | ||
| ${GUARDRAIL_PROMPT} | ||
| ${sessionContext}`; | ||
| } | ||
| // ── SDK mode (shorter prompt, OS-aware) ───────────────────────────── | ||
| const WINDOWS_SDK_BLOCK = `## Windows Gotchas | ||
| - ALWAYS wrap Windows commands in: powershell -Command "..." | ||
| - NEVER use bare app names for Windows built-ins (notepad, paint, calc) — triggers Store redirect dialog | ||
| - CORRECT: powershell -Command "Start-Process 'C:\\Windows\\System32\\notepad.exe'" | ||
| - WRONG: powershell -Command "Start-Process notepad" — opens Store dialog, app never launches | ||
| - For typing into apps: powershell -Command "Start-Process 'C:\\Windows\\System32\\notepad.exe'; Start-Sleep -Seconds 2; Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SendKeys]::SendWait('text')" | ||
| - Start-Process is async — MUST sleep 2 seconds before interacting with the opened window | ||
| - Use semicolons to chain PowerShell, not && (bash syntax) | ||
| - If a command "succeeded" but nothing happened, app is stuck at a Store/UAC dialog — use full .exe path | ||
| ## PowerShell patterns | ||
| - Open apps: powershell -Command "Start-Process chrome 'https://url.com'" or "Start-Process 'C:\\Windows\\System32\\notepad.exe'" | ||
| - File ops: powershell -Command "Get-Content 'file.txt'" / "Set-Content 'file.txt' 'content'" | ||
| - Window management: powershell -Command "(New-Object -ComObject Shell.Application).MinimizeAll()" | ||
| - Clipboard: powershell -Command "Set-Clipboard 'text'" | ||
| - Install software: powershell -Command "winget install --id 'App.Name' --accept-package-agreements" | ||
| - Git/npm/docker: run directly in bash (these work fine without powershell wrapper)`; | ||
| const MACOS_SDK_BLOCK = `## macOS Gotchas | ||
| - Use \`open -a "AppName"\` to launch apps; macOS resolves /Applications/AppName.app | ||
| - AppleScript via osascript needs Accessibility permission for System Events keystroke/click — first run prompts user | ||
| - 'open -a' returns immediately — sleep ~1 second before scripting against the new window | ||
| - For typing: osascript -e 'tell application "AppName" to activate' -e 'delay 1' -e 'tell application "System Events" to keystroke "text"' | ||
| - Don't try Windows commands (Start-Process, notepad) — they don't exist | ||
| - Don't try Linux commands (xdotool, xdg-open) — wrong OS | ||
| ## Shell patterns (bash/zsh on macOS) | ||
| - Open apps: open -a "Calculator" / open -a "TextEdit" file.txt / open https://url.com | ||
| - File ops: cat file.txt / echo "content" > file.txt / find ~/Documents -name '*.pdf' | ||
| - Window/keystroke (AppleScript): osascript -e 'tell application "System Events" to keystroke "h" using command down' | ||
| - Clipboard: echo "text" | pbcopy / pbpaste | ||
| - Install: brew install <pkg> (assume Homebrew) | ||
| - Git/npm/docker: run directly in bash/zsh`; | ||
| const LINUX_SDK_BLOCK = `## Linux Gotchas | ||
| - Detect display server first: \`[ -n "$WAYLAND_DISPLAY" ] && echo wayland || echo x11\` | ||
| - X11 → xdotool for typing/clicking, scrot for screenshots | ||
| - Wayland → ydotool for typing/clicking (requires ydotoold daemon), grim for screenshots | ||
| - xdotool can't reach Wayland clients — Wayland blocks input synthesis from arbitrary clients by design | ||
| - Use \`xdg-open\` for files/URLs, run binaries directly otherwise | ||
| - Background GUI launches with \`&\` — they don't return until exit | ||
| - Don't try Windows commands (Start-Process, notepad) — they don't exist | ||
| - Don't try macOS commands (open -a, osascript, pbcopy) — wrong OS | ||
| ## Shell patterns (bash on Linux) | ||
| - Open apps: xdg-open file.pdf / firefox 'https://url.com' & / gedit file.txt & | ||
| - File ops: cat file.txt / echo "content" > file.txt / find ~/Documents -name '*.pdf' | ||
| - Typing (X11): xdotool search --name "Window" windowactivate --sync; xdotool type --delay 50 "text" | ||
| - Typing (Wayland): ydotool type --next-delay 50 "text" | ||
| - Clipboard: xclip -selection clipboard (X11) or wl-copy (Wayland) | ||
| - Install: distro-dependent — apt / dnf / pacman / zypper | ||
| - Git/npm/docker: run directly in bash`; | ||
| function osBlockForSdk(platform) { | ||
| if (platform === 'win32') | ||
| return WINDOWS_SDK_BLOCK; | ||
| if (platform === 'darwin') | ||
| return MACOS_SDK_BLOCK; | ||
| return LINUX_SDK_BLOCK; | ||
| } | ||
| /** | ||
| * Build the SDK-mode (API-key path) system prompt for the given | ||
| * platform. Shorter than the CLI variant — SDK mode has the computer | ||
| * tool bundled at the API level, so the prompt focuses on shell-vs- | ||
| * computer-tool tradeoffs and OS-specific shell gotchas. | ||
| */ | ||
| export function buildSdkSystemPrompt(platform) { | ||
| const osLabel = OS_LABEL[platform]; | ||
| return `You are a computer control agent on ${osLabel}. CRITICAL: Use the bash tool with shell commands instead of screenshot-click loops whenever possible. | ||
| ## Self-Correction | ||
| 1. If a command fails, DO NOT retry it. Analyze the error and try a DIFFERENT approach. | ||
| 2. NEVER repeat a failed approach more than once. | ||
| 3. If a task takes more than 3 turns, STOP and reconsider — you're overcomplicating it. | ||
| ## Rules | ||
| 1. Prefer bash tool over computer tool for ALL tasks that can be done via command line. | ||
| 2. Only use the computer tool (screenshot/click) when the task genuinely requires visual interaction. | ||
| 3. Minimize screenshot frequency — don't screenshot after every action. Trust command output and exit codes. | ||
| 4. Combine multiple steps into single shell commands to reduce turns and cost. | ||
| ${osBlockForSdk(platform)} | ||
| ## Anti-patterns | ||
| - Do NOT screenshot to verify a window opened. Just open it. | ||
| - Do NOT click through UI menus when a shell command exists. | ||
| - Do NOT take screenshots after every single action. | ||
| - Do NOT use multiple turns for simple one-command tasks. | ||
| - Do NOT retry the same failed command — try something different. | ||
| ${GUARDRAI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AED,SAAS,aAAa,CAAC,QAA2B;IAChD,IAAI,QAAQ,KAAK,OAAO;QAAE,OAAO,iBAAiB,CAAC;IACnD,IAAI,QAAQ,KAAK,QAAQ;QAAE,OAAO,eAAe,CAAC;IAClD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAA2B,EAAE,cAAsB;IACtF,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnC,OAAO,6DAA6D,OAAO;;EAE3E,mBAAmB,CAAC,QAAQ,CAAC;;EAE7B,aAAa,CAAC,QAAQ,CAAC;;EAEvB,kCAAkC;EAClC,gBAAgB;EAChB,cAAc,EAAE,CAAC;AACnB,CAAC;AAED,uEAAuE;AAEvE,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;oFAgB0D,CAAC;AAErF,MAAM,eAAe,GAAG;;;;;;;;;;;;;;2CAcmB,CAAC;AAE5C,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;uCAiBe,CAAC;AAExC,SAAS,aAAa,CAAC,QAA2B;IAChD,IAAI,QAAQ,KAAK,OAAO;QAAE,OAAO,iBAAiB,CAAC;IACnD,IAAI,QAAQ,KAAK,QAAQ;QAAE,OAAO,eAAe,CAAC;IAClD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAA2B;IAC9D,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnC,OAAO,uCAAuC,OAAO;;;;;;;;;;;;;EAarD,aAAa,CAAC,QAAQ,CAAC;;;;;;;;EAQvB,gBAAgB,EAAE,CAAC;AACrB,CAAC"} |
+34
-0
@@ -14,2 +14,36 @@ # Changelog | ||
| ## [0.3.0] - 2026-04-25 | ||
| Cross-platform system prompts (no longer Windows-only despite the platform abstraction), CodeQL clear-text-logging fix, and a production-ready README rewrite. Both functional changes are additive — v0.2.0 Windows users see no behavior change. macOS / Linux operation is now intended-to-work but **empirically un-smoked** — the system-prompt branching is unit-tested but the LLM behavior under it is not yet verified against real model use on a non-Windows host. First post-publish report from a Mac or Linux user is the signal that locks in the "cross-platform" claim. | ||
| ### Documentation — production-ready README rewrite | ||
| The pre-v0.3 README was install + commands + a thin "Safety Guardrails" paragraph. v0.3.0 ships a structural rewrite covering the gaps a production-ready high-trust local computer-use tool needs: a "what you keep" sovereignty lead, an explicit cost-comparison table (Claude Login = $0, SDK + dario = $0, SDK direct = $X per task, hosted competitor = $20–50/mo flat), a full threat model with operating recommendations (review `--dry-run` before trusting a new task class, keep destructive ops scope-targeted, audit-log review cadence), an honest "Limitations & known issues" block (Wayland xdotool blind spot, macOS Accessibility first-run prompt, Claude-Login-no-audit-trail, cross-platform empirical state, SDK-mode-Anthropic-only), a troubleshooting / FAQ block, and a trust-and-transparency table mirroring claude-bridge's pattern (runtime deps count, network scope, telemetry status, branch protection, release attestation). Old content preserved where it was working — quickstart, commands reference, configuration, the Full Platform pitch, the Links + License footer. | ||
| ### Changed — system prompts are now OS-aware (no longer Windows-only despite the platform abstraction) | ||
| Pre-fix, both run modes hardcoded a Windows-only system prompt even though `src/platform/` had cliclick / xdotool / ydotool / scrot wired up for SDK-mode mouse / keyboard / screenshot. The LLM guidance was the missing piece — Claude was being told to run PowerShell on macOS / Linux where it doesn't exist: | ||
| - `src/cli-mode.ts:201` opened with *"You are a computer control agent with FULL access to this Windows machine"* and had ~115 lines of PowerShell-only examples (Windows 11 Store redirect workarounds, `Start-Process 'C:\\Windows\\System32\\notepad.exe'`, etc.). | ||
| - `src/sdk-mode.ts:29` opened with *"Use the bash tool with PowerShell commands instead of screenshot-click loops"* with similar Windows-only patterns. | ||
| Both prompts now branch on `process.platform` and ship matching guidance: | ||
| - **Windows (`win32`)** — PowerShell, `Start-Process`, `Get-ChildItem`, `Set-Clipboard`, `winget`, plus the Windows 11 Store redirect anti-pattern that was already documented. | ||
| - **macOS (`darwin`)** — `open -a "AppName"` for app launch, `osascript -e 'tell application "System Events" to keystroke "..."'` for keyboard automation, `pbcopy` / `pbpaste` for clipboard, `brew` for installs. Notes the Accessibility-permission prompt on first `osascript` run. | ||
| - **Linux (`linux`)** — `xdg-open` for files / URLs, `xdotool type` (X11) or `ydotool type` (Wayland) for keyboard automation, `xclip` (X11) or `wl-copy` (Wayland) for clipboard, with display-server detection (`[ -n "$WAYLAND_DISPLAY" ]`) baked in. Calls out that xdotool can't reach Wayland clients (input synthesis is blocked at the protocol level). | ||
| **Implementation:** new pure module `src/system-prompt.ts` with `buildCliSystemPrompt(platform, sessionContext)` and `buildSdkSystemPrompt(platform)` builders, plus `normalizePlatform()` (falls back to `linux` for non-Win/non-Mac Unix variants — every BSD has bash + the standard utilities, so the Linux block is the safest default). `cli-mode.ts` and `sdk-mode.ts` are now ~120 lines lighter each — they call the builders instead of inlining the prompts. 13 new assertions in `test/system-prompt.test.mjs` cover the OS branching, the shared frame across platforms, the empty-sessionContext edge, and a regression pin against the original *"FULL access to this Windows machine"* on non-Win prompts. `npm test` total goes 36 → 49 (all green). | ||
| **Marketing follow-through:** the `package.json` description swapped *"PowerShell-first"* for *"Cross-platform"* with a per-OS shell summary; keywords lost `powershell` and gained `windows` / `macos` / `linux` / `cross-platform`. The README's lead paragraph, "Shell-first" section (renamed from "PowerShell-first"), and architecture diagram all reflect the per-OS shell — the install table was already accurate (Windows / macOS / Linux X11 / Linux Wayland), it just had to stop being undermined by the lead copy. Historical v0.1.0 CHANGELOG entries left as-is — they describe what shipped at that time. | ||
| ### Security — close CodeQL `js/clear-text-logging` alert (high) | ||
| First CodeQL alert against the public repo. The flagged sink is `output.success()` in `src/util/output.ts:8`, with two upstream paths: | ||
| 1. **`src/auth.ts:90-91`** — `hands auth` status line emitted `sk-ant-...XXXX` (first 7 + last 4 chars of the stored API key). The first 7 chars are the well-known fixed `sk-ant-` prefix (zero entropy disclosure), but the last 4 are real key material — minimal but non-zero info disclosure. **Replaced with `***` only**, matching dario v3.7.2+'s "no substring of any stored key in user-facing output" rule. | ||
| 2. **`src/init.ts:93`** — final summary line interpolated a literal `' (key stored)'` based on a truthy check of `config.apiKey`. The value itself was never emitted (template's true-branch is a fixed string), but CodeQL's flow conservatively flags any read on the path to a logger. **Routed through a `Boolean(...)` intermediate** so the dataflow stops there. Behavior unchanged. | ||
| No behavior change for users — the `hands auth` status line just shows `Mode: API Key (***)` instead of the partial-key string. Existing tests still pass (no test referenced the masked format). | ||
| ## [0.2.0] - 2026-04-25 | ||
@@ -16,0 +50,0 @@ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAQA,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CA+DrD;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAOxD;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CA8BpD"} | ||
| {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAQA,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CA+DrD;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAOxD;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAkCpD"} |
+6
-2
@@ -82,5 +82,9 @@ import { execFile } from 'node:child_process'; | ||
| if (config.authMode === 'api_key') { | ||
| // Don't emit any substring of a stored key — not even the | ||
| // well-known `sk-ant-` prefix + last 4 chars. CodeQL's | ||
| // js/clear-text-logging flagged the substring leak; matches | ||
| // dario v3.7.2+'s "*** only" treatment of stored credentials in | ||
| // user-facing output. | ||
| if (config.apiKey) { | ||
| const masked = config.apiKey.slice(0, 7) + '...' + config.apiKey.slice(-4); | ||
| output.success(`Mode: API Key (${masked})`); | ||
| output.success('Mode: API Key (***)'); | ||
| } | ||
@@ -87,0 +91,0 @@ else { |
+1
-1
@@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M,CAAC;QACN,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,UAAU,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACtC,MAAM,CAAC,IAAI,CAAC,YAAY,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC5F,CAAC"} |
+2
-118
@@ -10,3 +10,3 @@ import { spawn } from 'node:child_process'; | ||
| import { VoiceInput } from './voice/index.js'; | ||
| import { GUARDRAIL_PROMPT } from './util/guardrails.js'; | ||
| import { buildCliSystemPrompt, normalizePlatform } from './system-prompt.js'; | ||
| export async function runCliMode(prompt, config, options = {}) { | ||
@@ -158,119 +158,3 @@ output.header('AskAlf Agent — Computer Control'); | ||
| const sessionContext = buildSessionContext(memory); | ||
| const systemPrompt = `You are a computer control agent with FULL access to this Windows machine. You can do ANYTHING — not just coding. | ||
| ## CRITICAL: Self-Correction Rules | ||
| 1. If a command fails, DO NOT retry the same command. Analyze why it failed and try a DIFFERENT approach. | ||
| 2. If you get an error, read the error message carefully. It tells you exactly what went wrong. | ||
| 3. NEVER repeat a failed approach more than once. After one failure, switch strategies entirely. | ||
| 4. Check if a program exists before trying to run it: Get-Command "program" -ErrorAction SilentlyContinue | ||
| 5. If a task takes more than 3 turns, STOP and reconsider your approach — you're probably overcomplicating it. | ||
| ## CRITICAL: PowerShell-First Approach | ||
| ALWAYS prefer PowerShell commands over screenshot-based interaction. Screenshots are slow, unreliable, and waste turns. PowerShell gives you direct, deterministic control. | ||
| ## Rules | ||
| 1. NEVER take a screenshot to find where to click. Use PowerShell to accomplish the task directly. | ||
| 2. ONLY use screenshots for tasks that truly require visual verification (e.g., "what color is the button?", "read text from an image"). | ||
| 3. When a task can be done via command line, ALWAYS use command line. No exceptions. | ||
| 4. Combine multiple steps into single PowerShell commands when possible to minimize turns. | ||
| ## Windows Gotchas — KNOWN ISSUES, DO NOT LEARN THESE THE HARD WAY | ||
| ### CRITICAL: Windows 11 Store Redirect | ||
| Windows 11 redirects "notepad", "paint", "calculator" etc. to the Microsoft Store. | ||
| Running "Start-Process notepad" opens a "Run just this once" / "Get from Store" dialog — NOT the actual app. | ||
| The command appears to succeed but the app is stuck at a dialog you cannot see. | ||
| FIX: ALWAYS use the full .exe path for Windows built-in apps: | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\notepad.exe'" # notepad | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\mspaint.exe'" # paint | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\calc.exe'" # calculator | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\SnippingTool.exe'" # snipping tool | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\cmd.exe'" # command prompt | ||
| ### Opening apps — CORRECT way | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\notepad.exe'" # CORRECT — full path, bypasses Store | ||
| powershell -Command "Start-Process chrome 'https://google.com'" # CORRECT — chrome is not a Store app | ||
| powershell -Command "Start-Process code" # CORRECT — VS Code is not a Store app | ||
| ### Opening apps — WRONG ways (DO NOT USE) | ||
| # Start-Process notepad # WRONG — triggers Windows 11 Store redirect dialog | ||
| # notepad # WRONG in bash — blocks or triggers Store dialog | ||
| # start notepad # WRONG — "start" is cmd.exe, not bash | ||
| # open notepad # WRONG — "open" is macOS only | ||
| ### Typing into GUI apps — CORRECT pattern | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\notepad.exe'; Start-Sleep -Seconds 2; Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SendKeys]::SendWait('Hello World')" | ||
| # MUST use full .exe path — NOT just "notepad" | ||
| # MUST wait for app to FULLY open (Start-Sleep -Seconds 2) before sending keys | ||
| # MUST use single PowerShell command — separate commands lose window focus | ||
| ### Verifying an app actually opened | ||
| After opening an app, verify it is running before interacting: | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\notepad.exe'; Start-Sleep -Seconds 2; if (Get-Process notepad -ErrorAction SilentlyContinue) { Write-Output 'Notepad is running' } else { Write-Output 'ERROR: Notepad did not start' }" | ||
| ### Common mistakes to avoid | ||
| - NEVER use bare app names for Windows built-in apps (notepad, paint, calc) — ALWAYS full .exe path | ||
| - Git Bash mangles Windows paths: use "powershell -Command" wrapper for all Windows operations | ||
| - "Start-Process" returns immediately — the app opens async, wait 2 seconds before interacting | ||
| - SendKeys requires the target window to be focused — always Start-Process + Sleep first | ||
| - Use semicolons to chain PowerShell commands, not && (which is bash syntax) | ||
| - For multi-line PowerShell: wrap in powershell -Command "line1; line2; line3" | ||
| - If a command "succeeded" but nothing happened, the app is probably stuck at a Store/UAC dialog | ||
| ## PowerShell Patterns — USE THESE | ||
| ### Open apps & URLs | ||
| powershell -Command "Start-Process chrome 'https://amazon.com'" | ||
| powershell -Command "Start-Process 'C:\\Windows\\System32\\notepad.exe'" | ||
| powershell -Command "Start-Process code 'C:\\project'" | ||
| powershell -Command "Start-Process explorer 'C:\\Users'" | ||
| powershell -Command "Start-Process ms-settings:" | ||
| ### File operations | ||
| powershell -Command "Get-ChildItem -Path C:\\Users -Recurse -Filter '*.pdf' | Select-Object FullName" | ||
| powershell -Command "New-Item -Path 'C:\\temp\\newfile.txt' -Value 'content here' -Force" | ||
| powershell -Command "Copy-Item 'source.txt' 'dest.txt'" | ||
| powershell -Command "Get-Content 'file.txt'" | ||
| powershell -Command "Set-Content 'file.txt' 'new content'" | ||
| ### Window management | ||
| powershell -Command "(New-Object -ComObject Shell.Application).MinimizeAll()" | ||
| powershell -Command "Stop-Process -Name 'notepad' -ErrorAction SilentlyContinue" | ||
| powershell -Command "Get-Process | Where-Object {\\$_.MainWindowTitle -ne ''} | Select-Object ProcessName, MainWindowTitle" | ||
| ### Clipboard | ||
| powershell -Command "Set-Clipboard 'text to copy'" | ||
| powershell -Command "Get-Clipboard" | ||
| ### System info | ||
| powershell -Command "Get-ComputerInfo | Select-Object WindowsVersion, OsArchitecture" | ||
| powershell -Command "Get-Volume | Select-Object DriveLetter, SizeRemaining, Size" | ||
| ### Install software | ||
| powershell -Command "winget install --id 'VideoLAN.VLC' --accept-package-agreements --accept-source-agreements" | ||
| ### Git, npm, Docker — use directly (these work fine in bash) | ||
| git clone https://github.com/user/repo | ||
| npm install -g @package/name | ||
| docker ps | ||
| ## Anti-patterns — NEVER DO THESE | ||
| - Do NOT screenshot to see if a window opened. Just open it. | ||
| - Do NOT screenshot to read a web page. Use Invoke-WebRequest or curl. | ||
| - Do NOT click through menus via coordinates. Use PowerShell or keyboard shortcuts. | ||
| - Do NOT take a screenshot after every action. Trust that commands worked (check exit codes instead). | ||
| - Do NOT use multiple turns for simple tasks. One PowerShell command should suffice. | ||
| - Do NOT run bare Windows commands in bash (notepad, start, etc.) — always wrap in powershell -Command. | ||
| - Do NOT retry the same failed command. If it failed once, it will fail again. Try something different. | ||
| ## When Screenshots ARE Appropriate | ||
| - User explicitly asks "what's on my screen?" | ||
| - Task requires reading visual content (charts, images, UI layouts) | ||
| - Debugging why a GUI app looks wrong | ||
| - Reading text that only exists in a rendered application (not in files) | ||
| You are NOT limited to software engineering. Help the user with ANY computer task. | ||
| ${GUARDRAIL_PROMPT} | ||
| ${sessionContext}`; | ||
| const systemPrompt = buildCliSystemPrompt(normalizePlatform(process.platform), sessionContext); | ||
| const args = [ | ||
@@ -277,0 +161,0 @@ '-p', prompt, |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"cli-mode.js","sourceRoot":"","sources":["../src/cli-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAA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AAC;YACf,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACrD,MAAM,CAAC,IAAI,KAAK,CACd,qEAAqE;oBACrE,sCAAsC,CACvC,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAiBA,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAkFrD"} | ||
| {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAiBA,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAyFrD"} |
+8
-1
@@ -85,3 +85,10 @@ // `hands init` — interactive first-run setup. | ||
| output.header('Ready'); | ||
| output.success(`auth: ${config.authMode}${config.authMode === 'api_key' && config.apiKey ? ' (key stored)' : ''}`); | ||
| // Boolean intermediate so CodeQL's js/clear-text-logging flow can | ||
| // see that we only consume the truthy-ness of apiKey, never its | ||
| // value. The template literal's true-branch is the fixed string | ||
| // ' (key stored)' — the key itself is never emitted — but CodeQL's | ||
| // dataflow conservatively flags any access on the path to a logger, | ||
| // and routing through Boolean(...) is the standard break. | ||
| const keyStored = config.authMode === 'api_key' && Boolean(config.apiKey); | ||
| output.success(`auth: ${config.authMode}${keyStored ? ' (key stored)' : ''}`); | ||
| output.success(`model: ${config.model}`); | ||
@@ -88,0 +95,0 @@ output.success(`budget: $${config.maxBudgetUsd.toFixed(2)} / ${config.maxTurns} turns`); |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,wEAAwE;AACxE,wEAAwE;AACxE,iEAAiE;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ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAKpD,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAYD,MAAM,WAAW,cAAc;IAC7B,mLAAmL;IACnL,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,CAmInH;AAyED,0GAA0G;AAC1G,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAW3G"} |
+4
-41
@@ -7,4 +7,5 @@ import Anthropic from '@anthropic-ai/sdk'; | ||
| import * as output from './util/output.js'; | ||
| import { checkCommand, GUARDRAIL_PROMPT } from './util/guardrails.js'; | ||
| import { checkCommand } from './util/guardrails.js'; | ||
| import { appendAudit } from './util/audit.js'; | ||
| import { buildSdkSystemPrompt, normalizePlatform } from './system-prompt.js'; | ||
| // Pricing per million tokens (claude-sonnet-4-6) | ||
@@ -18,41 +19,2 @@ const PRICING = { | ||
| const SCREENSHOT_MAX_WIDTH = 1280; | ||
| const SYSTEM_PROMPT = `You are a computer control agent. CRITICAL: Use the bash tool with PowerShell commands instead of screenshot-click loops whenever possible. | ||
| ## Self-Correction | ||
| 1. If a command fails, DO NOT retry it. Analyze the error and try a DIFFERENT approach. | ||
| 2. NEVER repeat a failed approach more than once. | ||
| 3. If a task takes more than 3 turns, STOP and reconsider — you're overcomplicating it. | ||
| 4. Check if programs exist first: powershell -Command "Get-Command 'program' -ErrorAction SilentlyContinue" | ||
| ## Rules | ||
| 1. Prefer bash tool (PowerShell) over computer tool for ALL tasks that can be done via command line. | ||
| 2. Only use the computer tool (screenshot/click) when the task genuinely requires visual interaction. | ||
| 3. Minimize screenshot frequency — don't screenshot after every action. Trust command output and exit codes. | ||
| 4. Combine multiple steps into single PowerShell commands to reduce turns and cost. | ||
| ## Windows Gotchas | ||
| - ALWAYS wrap Windows commands in: powershell -Command "..." | ||
| - NEVER use bare app names for Windows built-ins (notepad, paint, calc) — triggers Store redirect dialog | ||
| - CORRECT: powershell -Command "Start-Process 'C:\\Windows\\System32\\notepad.exe'" | ||
| - WRONG: powershell -Command "Start-Process notepad" — opens Store dialog, app never launches | ||
| - For typing into apps: powershell -Command "Start-Process 'C:\\Windows\\System32\\notepad.exe'; Start-Sleep -Seconds 2; Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SendKeys]::SendWait('text')" | ||
| - Start-Process is async — MUST sleep 2 seconds before interacting with the opened window | ||
| - Use semicolons to chain PowerShell, not && (bash syntax) | ||
| - If a command "succeeded" but nothing happened, app is stuck at a Store/UAC dialog — use full .exe path | ||
| ## PowerShell patterns | ||
| - Open apps: powershell -Command "Start-Process chrome 'https://url.com'" or "Start-Process 'C:\\Windows\\System32\\notepad.exe'" | ||
| - File ops: powershell -Command "Get-Content 'file.txt'" / "Set-Content 'file.txt' 'content'" | ||
| - Window management: powershell -Command "(New-Object -ComObject Shell.Application).MinimizeAll()" | ||
| - Clipboard: powershell -Command "Set-Clipboard 'text'" | ||
| - Install software: powershell -Command "winget install --id 'App.Name' --accept-package-agreements" | ||
| - Git/npm/docker: run directly in bash (these work fine without powershell wrapper) | ||
| ## Anti-patterns | ||
| - Do NOT screenshot to verify a window opened. Just open it. | ||
| - Do NOT click through UI menus when a PowerShell command exists. | ||
| - Do NOT take screenshots after every single action. | ||
| - Do NOT use multiple turns for simple one-command tasks. | ||
| - Do NOT retry the same failed command — try something different. | ||
| ${GUARDRAIL_PROMPT}`; | ||
| export async function runSdkMode(prompt, config, opts = {}) { | ||
@@ -62,2 +24,3 @@ const client = new Anthropic({ apiKey: config.apiKey }); | ||
| const model = config.model; | ||
| const systemPrompt = buildSdkSystemPrompt(normalizePlatform(process.platform)); | ||
| // Calculate the display dimensions we tell Claude (matches screenshot size) | ||
@@ -121,3 +84,3 @@ const scaleFactor = Math.min(1.0, SCREENSHOT_MAX_WIDTH / realWidth); | ||
| messages, | ||
| system: SYSTEM_PROMPT, | ||
| system: systemPrompt, | ||
| betas: ['computer-use-2025-11-24'], | ||
@@ -124,0 +87,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"sdk-mode.js","sourceRoot":"","sources":["../src/sdk-mode.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAU9C,iDAAiD;AACjD,MAAM,OAAO,GAAsD;IACjE,mBAAmB,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;IAC7C,iBAAiB,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;IAC5C,2BAA2B,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE;CACvD,CAAC;AAEF,mEAAmE;AACnE,MAAM,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AAS,eAAe,CAAC,QAA2C,EAAE,QAAgB;IACpF,IAAI,eAAe,GAAG,CAAC,CAAC;IAExB,iCAAiC;IACjC,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC;QACzB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/B,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;gBAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;oBAC3E,eAAe,EAAE,CAAC;oBAClB,IAAI,eAAe,GAAG,QAAQ,EAAE,CAAC;wBAC/B,2BAA2B;wBAC3B,MAAM,OAAO,GAAG,KAA2C,CAAC;wBAC5D,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;wBACzB,OAAO,CAAC,MAAM,CAAC,GAAG,sBAAsB,CAAC;wBACzC,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;oBAC3B,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"} |
+6
-3
| { | ||
| "name": "@askalf/hands", | ||
| "version": "0.2.0", | ||
| "description": "Computer-use agent. Your LLM on your mouse, keyboard, and screen. PowerShell-first, voice optional, safety guardrails. Routes through dario or any Anthropic-compat endpoint.", | ||
| "version": "0.3.0", | ||
| "description": "Cross-platform computer-use agent. Your LLM on your mouse, keyboard, and screen. Windows (PowerShell), macOS (open + osascript), Linux (xdotool / ydotool). Voice optional, safety guardrails. Routes through dario or any Anthropic-compat endpoint.", | ||
| "main": "./dist/cli.js", | ||
@@ -67,3 +67,6 @@ "types": "./dist/cli.d.ts", | ||
| "voice-control", | ||
| "powershell", | ||
| "cross-platform", | ||
| "windows", | ||
| "macos", | ||
| "linux", | ||
| "dario", | ||
@@ -70,0 +73,0 @@ "local" |
+267
-145
@@ -1,36 +0,64 @@ | ||
| # hands | ||
| <p align="center"> | ||
| <h1 align="center">hands</h1> | ||
| <p align="center"><strong>Your LLM on your mouse, keyboard, and screen.</strong><br>A local computer-use agent that drives the OS through its native shell — PowerShell on Windows, <code>open</code> + AppleScript on macOS, <code>xdotool</code> / <code>ydotool</code> on Linux. Voice optional. Routes through <a href="https://github.com/askalf/dario">dario</a> or any Anthropic-compat endpoint, so the per-task token spend bills against the Claude Max subscription you already pay for instead of a hosted research-tool tier on top.</p> | ||
| </p> | ||
| **Your LLM on your mouse, keyboard, and screen.** | ||
| <p align="center"><em>Pre-1.0. MIT. Independent, unofficial, third-party — see <a href="DISCLAIMER.md">DISCLAIMER</a>.</em></p> | ||
| One npm install. Hands-on computer control — PowerShell-first for speed, screenshot tool for visual verification when needed, voice input optional. Routes through [dario](https://github.com/askalf/dario) or any Anthropic-compat endpoint — keep using your Claude Max subscription and pay zero per-token on the happy path. | ||
| <p align="center"> | ||
| <a href="https://www.npmjs.com/package/@askalf/hands"><img src="https://img.shields.io/npm/v/@askalf/hands?color=blue" alt="npm version"></a> | ||
| <a href="https://github.com/askalf/hands/actions/workflows/ci.yml"><img src="https://github.com/askalf/hands/actions/workflows/ci.yml/badge.svg" alt="CI"></a> | ||
| <a href="https://github.com/askalf/hands/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@askalf/hands" alt="License"></a> | ||
| </p> | ||
| > **Status:** seeded from `@askalf/hands`'s v0.3.7 tree (commit `bef177d`), the last standalone computer-use state before that repo pivoted to a fleet-bridge role. This repo is the continuation of that work — pre-1.0, modernization in progress. | ||
| --- | ||
| ## Install | ||
| ## What you keep | ||
| ```bash | ||
| npm i -g @askalf/hands | ||
| ``` | ||
| Hosted computer-use products take four decisions away from you: | ||
| Requires Node.js 20+ and [Claude CLI](https://docs.anthropic.com/en/docs/claude-code). | ||
| **Your data.** Every prompt, every screenshot, every keystroke the agent emits — all of it goes to the vendor's servers. With hands, none of that exists. The model runs on whatever endpoint *you* point at; the screen and the keyboard belong to your machine. The only outbound connections are to your chosen LLM endpoint. No telemetry, no analytics. Inspectable: `lsof -i` during a run. | ||
| ## Quick Start | ||
| **Your model.** Hosted products pick for you. hands routes through whatever endpoint you configure — Anthropic direct, Claude Max via [dario](https://github.com/askalf/dario), or any Anthropic-compat URL. | ||
| **Your shell.** Hosted products simulate clicks and keystrokes via screenshot loops because they don't have your shell. hands has your shell. The agent prefers a one-line `Start-Process` / `open -a` / `xdotool` over a four-screenshot click loop, which is dramatically faster and cheaper. | ||
| **Your audit trail.** SDK mode appends every tool call to `~/.hands/audit.jsonl` — timestamps, args, durations, outcomes. `--dry-run` shows what an agent *would* do without doing it. Both work locally; nothing leaves your machine. | ||
| ## What you stop paying for | ||
| Most people reading this already pay Anthropic for Claude Max ($100–200/mo). A computer-use task — "open the spreadsheet, add a row, save it" — runs through 10–60 LLM calls in the agent loop. Through Anthropic's per-token API, that's pennies per task; through a hosted UI on top, that's another subscription tier. | ||
| | How you run it | Per-task cost | Data stays local? | | ||
| |---|---|---| | ||
| | Claude Login mode (Claude Max subscription via `claude` CLI) | **$0** | ✅ | | ||
| | SDK mode + dario (Claude Max via local proxy) | **$0** | ✅ | | ||
| | SDK mode + direct Anthropic API | **~$0.05–$2 per task** depending on screenshots | ✅ | | ||
| | Hosted "AI does your computer for you" tier | $20–50/mo flat | ❌ | | ||
| `hands run` defaults to **Claude Login mode** — the zero-cost path. SDK mode is only invoked when you explicitly choose API Key during `hands auth`, or when `--dry-run` forces it (Claude Login dispatches tools inside the `claude` child process, where hands can't intercept and audit-log them). | ||
| --- | ||
| ## 60 seconds | ||
| ```bash | ||
| # 1. One-shot interactive setup — auth + voice (optional) + dario routing tips | ||
| hands init | ||
| # 1. Install | ||
| npm i -g @askalf/hands | ||
| hands init # interactive: auth, voice, dario routing | ||
| # 2. Run | ||
| hands run "open notepad and type hello world" | ||
| # 3. Voice mode — talk to your computer (if you said yes to voice during init) | ||
| hands run "open notepad" --voice | ||
| hands run "open VS Code in ~/projects/api and run npm test" | ||
| hands run "open chrome and go to amazon.com" --voice | ||
| ``` | ||
| `hands init` walks through every choice the CLI asks you to make: installing the `claude` CLI if missing (needed for zero-per-token Claude Login mode), picking auth mode, optionally downloading whisper.cpp for voice, and — if you're on API Key mode — nudging you toward routing through [dario](https://github.com/askalf/dario) for zero per-token cost. Safe to re-run at any time. | ||
| `hands init` walks every choice the CLI asks of a new user: install `claude` CLI if missing, pick auth mode, optionally download whisper.cpp for voice, surface dario routing tip in API-Key mode. Safe to re-run. | ||
| Then Claude opens Notepad, types "Hello World", and asks **"What next?"** — type or speak your next command. | ||
| Requires **Node.js 20+** and (for the recommended Claude Login mode) the [Claude CLI](https://docs.anthropic.com/en/docs/claude-code). | ||
| ## How It Works | ||
| --- | ||
| ## What a day looks like | ||
| ``` | ||
@@ -64,11 +92,52 @@ $ hands run "open chrome and go to amazon.com" | ||
| **PowerShell-first** — Claude runs PowerShell commands directly to open apps, browse the web, manage files, and automate tasks. No slow screenshot loops. A screenshot MCP tool is available when Claude needs to visually verify what's on screen, but most tasks complete entirely through PowerShell. | ||
| The agent prefers the OS-native shell over screenshot-click loops: | ||
| **Voice control** — Add `--voice` to speak commands instead of typing. Uses local [whisper.cpp](https://github.com/ggerganov/whisper.cpp) for transcription — free, private, completely offline. No cloud APIs, no data leaves your machine. | ||
| - **Windows** — PowerShell (`Start-Process`, `Get-ChildItem`, `Set-Clipboard`, `winget`). | ||
| - **macOS** — `open -a` for app launch, `osascript` for keystrokes / window control, `pbcopy` / `pbpaste` for clipboard, `brew` for installs. | ||
| - **Linux** — `xdg-open` for files / URLs, `xdotool` (X11) or `ydotool` (Wayland) for keystrokes, `xclip` / `wl-copy` for clipboard, distro-appropriate package manager. Display server is detected at start of each run. | ||
| A screenshot MCP tool is available when Claude needs to visually verify what's on screen, but most tasks complete entirely through the shell. `hands doctor` reports which platform tools are installed. | ||
| **Voice control** — Add `--voice` to speak commands instead of typing. Uses local [whisper.cpp](https://github.com/ggerganov/whisper.cpp) for transcription — free, private, offline. No cloud APIs. | ||
| --- | ||
| ## How it works | ||
| Two run modes, one consistent UX: | ||
| ``` | ||
| hands run "open chrome" --voice | ||
| │ | ||
| ├── Input ───────────────────────────── | ||
| │ │ | ||
| │ ├── --voice OFF: readline (keyboard) | ||
| │ └── --voice ON: mic → whisper.cpp → text | ||
| │ | ||
| ├── Claude Login (default, $0/task on Claude Max) | ||
| │ │ | ||
| │ ├── Spawns claude CLI | ||
| │ ├── --append-system-prompt (OS-aware computer control agent) | ||
| │ ├── --mcp-config (screenshot tool) | ||
| │ ├── Claude uses built-in bash → OS-native shell | ||
| │ │ (PowerShell / open+osascript / xdotool|ydotool) | ||
| │ └── Interactive loop: task → "What next?" → repeat | ||
| │ | ||
| └── SDK / API Key (per-token unless routed through dario) | ||
| │ | ||
| ├── Anthropic SDK direct (or dario-proxied via ANTHROPIC_BASE_URL) | ||
| ├── computer_20251124 + bash + text_editor tools | ||
| ├── Single-run with cost summary | ||
| └── Every tool call appended to ~/.hands/audit.jsonl | ||
| ``` | ||
| The system prompt branches on `process.platform` and ships matching examples for the detected OS. Both modes run the model on the host — hands does not relay, proxy, or upload your screen anywhere except the LLM endpoint you configured. | ||
| --- | ||
| ## Authentication | ||
| ### Claude Login (Recommended) | ||
| ### Claude Login (recommended, default) | ||
| Uses your existing Claude Pro/Max subscription. **Zero extra API costs.** This is the default. | ||
| Uses your existing Claude Max subscription. **Zero per-token cost.** | ||
@@ -82,6 +151,8 @@ ```bash | ||
| ### API Key (Fallback) | ||
| Claude Login mode spawns the `claude` CLI as a child process. It dispatches tool calls itself, which means individual tool invocations are not visible to hands and not written to the audit log. If you need a full local audit trail, use SDK mode (or run with `--dry-run`, which forces SDK). | ||
| Paste your Anthropic API key. Pay per token. Uses the Anthropic SDK directly with the `computer_20251124` tool. | ||
| ### API Key (fallback) | ||
| Paste an Anthropic API key. Pay per token (or zero if routed through dario — see below). | ||
| ```bash | ||
@@ -92,7 +163,7 @@ hands auth | ||
| > **Note:** SDK mode uses computer-use API calls which cost per token. A simple task like "open notepad" can cost several dollars. Claude Login mode is strongly recommended. | ||
| > Heads-up: SDK mode uses the computer-use beta which charges per token including screenshots. A single "open notepad" task can run several dollars at direct API rates. Prefer Claude Login or SDK + dario. | ||
| ### Routing through dario (zero per-token cost in SDK mode) | ||
| If you're running [dario](https://github.com/askalf/dario) locally, hands will auto-route SDK-mode calls through it — including SDK mode's computer-use calls, which can then bill against your Claude Max subscription instead of per-token API overage. The `@anthropic-ai/sdk` client defaults its `baseURL` and `apiKey` to the standard env vars, so this works with zero hands-side config: | ||
| If you're running [dario](https://github.com/askalf/dario) locally, hands' SDK-mode calls auto-route through it — including the computer-use beta — so they bill against your Claude Max subscription instead of per-token API overage. The Anthropic SDK reads `ANTHROPIC_BASE_URL` and `ANTHROPIC_API_KEY` from env by default, so there's no hands-side config: | ||
@@ -102,3 +173,3 @@ ```bash | ||
| export ANTHROPIC_BASE_URL=http://localhost:3456 | ||
| export ANTHROPIC_API_KEY=dario # or your DARIO_API_KEY if you set one | ||
| export ANTHROPIC_API_KEY=dario # or your DARIO_API_KEY if set | ||
@@ -109,163 +180,143 @@ dario proxy # keep this running | ||
| Verify the routing is live with `hands check` (reports the effective base URL) or by watching `dario proxy -v` while hands is running — a request should show up in dario's log. Claude Login mode (the default) spawns the `claude` CLI child process directly, so the env-var-routing flow only matters for SDK mode. | ||
| Verify routing with `hands doctor` (reports the effective base URL) or by watching `dario proxy --verbose` while hands runs. Claude Login mode spawns the `claude` CLI directly — env-routing only matters for SDK mode. | ||
| ## Commands | ||
| --- | ||
| ### `hands init` | ||
| ## ⚠️ Security | ||
| Interactive first-run wizard. One command covers every choice hands asks a new user to make before their first `hands run`: install `claude` CLI if missing, pick auth mode (Claude Login vs API Key), optionally download whisper.cpp for voice, and — if you're on API Key mode — surface the dario routing tip for zero per-token cost. Delegates to the same `hands auth` / `hands voice-setup` flows the individual commands use, so there's no duplicated logic. | ||
| hands is a high-trust tool: **the agent has shell, keyboard, mouse, and screenshot access on your machine**, gated only by your auth choice and the operating recommendations below. Treat it accordingly. | ||
| ```bash | ||
| hands init | ||
| ``` | ||
| ### Threat model | ||
| Safe to re-run — every step asks before changing anything, and defaults reflect current config. Environment snapshot at the top shows what's already installed so you know what will be skipped. | ||
| - **Prompt injection.** A web page, an email, a PDF the agent reads can carry instructions Claude wasn't supposed to follow. The agent's bias toward shell over screenshot-click loops *narrows* this surface — typed text from a webpage rarely flows back into a `Start-Process` call — but does not eliminate it. Mitigations: review `--dry-run` before trusting a new task class; keep destructive operations to specific files / folders rather than recursive parents; use `hands run "..."` for one task at a time rather than open-ended sessions on untrusted material. | ||
| - **Lost machine / shoulder-surfed terminal.** API keys live in `~/.hands/config.json` (auto-set to `0700` perms on POSIX). A user who can read that file can issue API calls on your account. `hands auth --status` shows `Mode: API Key (***)` — no key material is emitted in user-facing output (CodeQL `js/clear-text-logging` closed in v0.3.0). | ||
| - **Unaudited Claude Login mode.** The `claude` CLI dispatches tools inside its own process; hands cannot intercept those calls to audit-log them. If you need a full local trail (every shell command, mouse event, screenshot), use SDK mode or `--dry-run`. | ||
| - **Computer-use beta cost.** SDK-mode without dario charges per token *including screenshots* — every screenshot the model takes adds vision tokens. A few-dollar task is plausible at direct API rates. The shell-first system prompt suppresses unnecessary screenshots, but a task that genuinely needs visual verification will spend. | ||
| - **Voice transcription.** whisper.cpp runs entirely local — no audio leaves the machine. Recordings are written to a temp file during transcription and unlinked immediately after. SoX / arecord are invoked via `execFile` with argv arrays (not shell strings) so input filenames can't be injected. | ||
| ### `hands run "<prompt>"` | ||
| ### Operating recommendations | ||
| Start an interactive computer control session. | ||
| - **Review `--dry-run` for anything you don't trust by reflex.** SDK-mode `--dry-run` runs the full agent loop with every tool call audit-logged but stubbed — no shell fires, no keys press, no mouse moves. Read `~/.hands/audit.jsonl` after; reopen for real if it looks right. | ||
| - **Keep destructive operations targeted.** `hands run "delete files in ~/Downloads"` is a safer prompt than `hands run "clean up my computer"`. The narrower the scope of the prompt, the narrower the agent's reach for failure modes. | ||
| - **Use SDK mode or `--dry-run` when you need an audit trail.** Claude Login mode is the cheapest path but also the least observable. For sysadmin / high-impact runs, the audit log is worth the per-token cost. | ||
| - **Don't run hands as root / Administrator.** The agent's shell access is exactly your shell access. Running as root makes `rm -rf /` a one-prompt foot-gun the guardrails won't necessarily catch. | ||
| - **Rotate API keys after suspected exposure.** If your dev machine is compromised or borrowed, treat the API key in `~/.hands/config.json` as exposed. Revoke at [console.anthropic.com](https://console.anthropic.com), then `hands auth` to install the new one. | ||
| - **Review the audit log periodically.** `tail -100 ~/.hands/audit.jsonl` after a session that touched anything important. | ||
| ```bash | ||
| hands run "resize all images in ./assets to 800px wide" | ||
| hands run "open VS Code and create a Flask hello world app" | ||
| hands run "go to github.com and star the askalf/hands repo" | ||
| ``` | ||
| ### Reporting | ||
| Each task completes and prompts **"What next?"** for follow-up commands. Type `exit` or hit Ctrl+C to end the session. | ||
| Found a security issue? Email **security@askalf.org** — don't open a public issue. See [SECURITY.md](SECURITY.md). | ||
| Options: | ||
| - `-v, --voice` — Use voice input (microphone → whisper transcription) | ||
| - `-m, --model <model>` — Model to use (default: `claude-sonnet-4-6`) | ||
| - `-b, --budget <amount>` — Max budget in USD for SDK mode (default: `5.00`) | ||
| - `-t, --turns <count>` — Max turns per task (default: `50`) | ||
| ### Built-in guardrails | ||
| ### `hands auth` | ||
| The system prompt also includes hard-block guidance for clearly destructive patterns the agent will refuse to execute: | ||
| Configure authentication interactively. | ||
| - Recursive root deletion (`rm -rf /`, `Remove-Item -Recurse C:\`, etc.) | ||
| - Disk formatting / partition modification | ||
| - Registry destruction (Windows) / `defaults delete` chains (macOS) / `/etc` overwrites (Linux) | ||
| - Boot config changes | ||
| - Firewall disabling | ||
| - User account creation | ||
| - Ransomware-pattern encryption sweeps | ||
| - `hands auth --status` — Show current auth status | ||
| These are **system-prompt guardrails, not sandboxing.** They reduce the chance the model emits a destructive command on its own initiative; they do not prevent a user from explicitly instructing one. The strongest guardrail is your prompt. | ||
| ### `hands voice-setup` | ||
| --- | ||
| Download whisper.cpp binary and speech model for voice control. One-time setup. | ||
| ## Limitations & known issues | ||
| ```bash | ||
| hands voice-setup # default: base.en model (~148MB) | ||
| hands voice-setup --model tiny # smaller/faster (~75MB) | ||
| hands voice-setup --model small # more accurate (~466MB) | ||
| ``` | ||
| Pre-1.0. Honest about what doesn't work yet: | ||
| ### `hands run "<prompt>" --dry-run` | ||
| - **Cross-platform LLM behavior is empirical.** v0.3.0 ships OS-aware system prompts (PowerShell / `open` + `osascript` / `xdotool` / `ydotool`) but the actual model behavior under the macOS and Linux blocks is not yet smoke-tested against real Claude calls. Expect the first non-Windows run to surface rough edges in the example commands. Report what didn't work and we'll tune the prompts. Windows is well-exercised. | ||
| - **Wayland input synthesis is restricted by the protocol.** `xdotool` cannot type into Wayland clients — Wayland blocks input synthesis from arbitrary clients by design. `ydotool` works but requires the `ydotoold` daemon running with appropriate uinput permissions. `hands doctor` reports whether the daemon is reachable. | ||
| - **macOS Accessibility permission on first run.** `osascript -e 'tell application "System Events" to keystroke "..."'` requires Accessibility permission for the parent process. First run will trigger a system prompt; users have to allow it once before keystroke automation works. | ||
| - **Claude Login mode lacks an audit trail.** As covered in the security section — the `claude` CLI doesn't surface tool calls back to hands. Full audit requires SDK mode. | ||
| - **SDK mode is Anthropic-only today.** The computer-use beta (`computer_20251124`) is an Anthropic API; OpenAI / Gemini have no native equivalent. dario routing helps for non-computer-use traffic but does not bridge this. Provider abstraction is a v0.4 candidate, not in v0.3. | ||
| - **`--dry-run` does not prevent every side effect of the planning step.** If the model decides to call a tool that involves an HTTP request as part of "planning what to do," that request still fires (in SDK mode `--dry-run` only stubs the *executor*, not the *model's own reads*). Practically rare; flagging in case it matters. | ||
| - **Voice mode requires SoX (Windows / macOS) or arecord (Linux).** Whisper binary is downloaded by `hands voice-setup`; recording dependency is a separate install — doctor reports it. | ||
| - **No session resume across reboots.** Session memory lives in process; once you exit `hands run`, the conversation is gone. Long multi-day automation is out of scope today. | ||
| Run the agent without actually doing anything on the host. In SDK mode, every tool call (shell, keyboard, mouse, screenshot) is **logged and stubbed** — the agent sees success results so the loop continues, but no command executes, no key presses, no cursor moves. The audit log at `~/.hands/audit.jsonl` shows what it would have done. | ||
| --- | ||
| ```bash | ||
| hands run "organize my downloads folder" --dry-run | ||
| # → agent plans + the audit log shows every action it would have taken | ||
| cat ~/.hands/audit.jsonl | tail -20 | ||
| ``` | ||
| ## Platform support | ||
| Useful for reviewing an agent's plan before trusting it with a new task, or smoke-testing a prompt change without side effects. Not supported in Claude Login mode (the `claude` child process dispatches tools itself; hands can't intercept them) — `--dry-run` forces SDK mode for that invocation. | ||
| | OS | Status | Computer Control | Notes | | ||
| |---|---|---|---| | ||
| | **Windows 10 / 11** | Best-supported | PowerShell (pre-installed) | The OS hands was developed and exercised on | | ||
| | **macOS 12+** | Cross-platform smoke pending | `open` + AppleScript / `osascript` | Accessibility permission required for keystrokes; install `cliclick` (`brew install cliclick`) for `hands` SDK-mode mouse / keyboard | | ||
| | **Linux (X11)** | Cross-platform smoke pending | `xdotool` + `scrot` | `apt install xdotool scrot` (Debian/Ubuntu); equivalents on other distros | | ||
| | **Linux (Wayland)** | Cross-platform smoke pending | `ydotool` + `grim` | `ydotoold` daemon required for input; `apt install ydotool grim` | | ||
| ### Audit log | ||
| Voice control needs SoX (Windows / macOS via `choco install sox` / `brew install sox`) or arecord (Linux, usually pre-installed). | ||
| Every tool invocation in SDK mode is appended to `~/.hands/audit.jsonl` with timestamp, tool name, action, summarized args (image bytes stripped, long strings truncated), duration, and outcome. The file rotates to `audit.jsonl.old` when it exceeds 10 MB. Paste the tail into issues when reporting bugs. | ||
| Run **`hands doctor`** to verify your setup — reports every dependency state with install hints for what's missing. | ||
| ```bash | ||
| tail -3 ~/.hands/audit.jsonl | ||
| # {"ts":1761307432021,"tool":"computer","action":"screenshot","args":{},"durationMs":45,"ok":true} | ||
| # {"ts":1761307432190,"tool":"bash","args":{"command":"Get-Process"},"durationMs":112,"ok":true} | ||
| # {"ts":1761307432340,"tool":"computer","action":"left_click","args":{"coordinate":[640,400]},"durationMs":22,"ok":true} | ||
| ``` | ||
| --- | ||
| Claude Login mode delegates tool execution to the `claude` child process, which doesn't surface individual tool calls back to hands — actions there are not logged. Use SDK mode (`hands auth` → API Key, or `--dry-run` which forces SDK) if you need a full local audit trail. | ||
| ## Commands | ||
| ### `hands doctor` | ||
| ### Setup | ||
| Aggregated health report covering every subsystem hands depends on: Node version, platform, config dir state + permissions, screenshot / mouse / keyboard tool availability, Claude CLI install + version, whisper.cpp install, and — if `ANTHROPIC_BASE_URL` is set — a reachability probe for dario. Exit code 1 on any fail, 0 otherwise. Paste it into issues. | ||
| ```bash | ||
| hands doctor # text table, non-destructive (no browser opens, no config writes) | ||
| hands doctor --json # structured output for scripts | ||
| hands doctor --skip-dario # skip the dario HTTP probe | ||
| hands doctor --skip-whisper # skip the whisper-install check (useful in CI) | ||
| hands init # one-shot interactive setup; safe to re-run | ||
| hands auth # change auth mode (Claude Login ↔ API Key) | ||
| hands auth --status # show current auth mode (no key material emitted) | ||
| hands voice-setup # download whisper.cpp + speech model for --voice | ||
| ``` | ||
| ### `hands check` | ||
| ### Running | ||
| Older narrower version of `doctor` — platform deps only. Kept for backwards compat; `doctor` covers everything `check` does plus auth + config + dario routing state. | ||
| ```bash | ||
| hands run "<prompt>" # interactive computer control session | ||
| hands run "<prompt>" --voice # voice input via local whisper | ||
| hands run "<prompt>" --dry-run # plan + audit-log without executing (SDK mode) | ||
| hands run "<prompt>" -m claude-opus-4-6 # override model | ||
| hands run "<prompt>" -b 10.00 # SDK budget cap (USD); default $5.00 | ||
| hands run "<prompt>" -t 100 # max turns per task; default 50 | ||
| ``` | ||
| ### `hands config` | ||
| ### Health & diagnostics | ||
| View or update configuration. | ||
| ```bash | ||
| hands config --model claude-opus-4-6 --turns 100 | ||
| hands doctor # aggregated health report; paste into bug reports | ||
| hands doctor --json # structured for CI / scripts | ||
| hands doctor --skip-dario # skip the dario reachability probe | ||
| hands check # platform-deps subset of doctor (legacy; doctor covers everything) | ||
| hands config # view config | ||
| hands config --model claude-opus-4-6 --turns 100 # update fields | ||
| ``` | ||
| ## What It Can Do | ||
| `hands run --dry-run` is the audit-trail-and-no-side-effects path; useful for first runs against new task classes or for reviewing a model's plan before committing. Forces SDK mode if you're on Claude Login (Claude Login can't be intercepted at the tool level). | ||
| | Capability | How | | ||
| |---|---| | ||
| | **Open apps** | `Start-Process chrome`, `Start-Process notepad` | | ||
| | **Browse the web** | Opens Chrome, navigates sites, fills forms | | ||
| | **Manage files** | Create, move, read, edit files anywhere on your system | | ||
| | **Run commands** | Git, npm, Docker, Python — any CLI tool | | ||
| | **See your screen** | Screenshot tool for visual verification when needed | | ||
| | **Voice control** | Speak commands via local whisper.cpp — offline, private | | ||
| | **Chain tasks** | Interactive loop — complete a task, ask "What next?" | | ||
| | **Session memory** | Remembers what worked and what failed across the session | | ||
| | **Self-correction** | Learns from errors within the session and adapts approach | | ||
| --- | ||
| ## Safety Guardrails | ||
| Built-in command guardrails prevent catastrophic operations before they reach the shell: | ||
| - **Hard blocks** — recursive root deletion, disk formatting, registry destruction, boot config changes, firewall disabling, user account creation, ransomware-like encryption patterns | ||
| - **System prompt injection** — Claude is instructed to verify destructive operations and prefer safe alternatives | ||
| - **Voice pipeline hardening** — input validation, temp file cleanup, process isolation | ||
| ## Platform Support | ||
| | OS | Status | Computer Control | | ||
| |----|--------|-----------------| | ||
| | **Windows** | Full support | PowerShell (pre-installed) | | ||
| | **macOS** | Full support | `cliclick` (`brew install cliclick`) | | ||
| | **Linux (X11)** | Full support | `xdotool` + `scrot` (`apt install xdotool scrot`) | | ||
| | **Linux (Wayland)** | Full support | `ydotool` + `grim` (`apt install ydotool grim`) | | ||
| **Voice control** requires SoX (Windows/macOS) or arecord (Linux, pre-installed). Whisper binary is downloaded automatically by `voice-setup`. | ||
| Run `hands check` to verify your setup. | ||
| ## Architecture | ||
| ``` | ||
| hands run "open chrome" --voice | ||
| │ | ||
| ├── Input ───────────────────────────── | ||
| │ │ | ||
| │ ├── --voice OFF: readline (keyboard) | ||
| │ └── --voice ON: mic → whisper.cpp → text | ||
| │ | ||
| ├── Claude Login (default) | ||
| │ │ | ||
| │ ├── Spawns claude CLI | ||
| │ ├── --append-system-prompt (computer control agent) | ||
| │ ├── --mcp-config (screenshot tool) | ||
| │ ├── Claude uses built-in bash → PowerShell | ||
| │ └── Interactive loop: task → "What next?" → repeat | ||
| │ | ||
| └── API Key (fallback) | ||
| │ | ||
| ├── Anthropic SDK direct | ||
| ├── computer_20251124 + bash + text_editor tools | ||
| └── Single-run with cost summary | ||
| src/ | ||
| cli.ts # Commander entry, command dispatch | ||
| init.ts # interactive first-run wizard | ||
| auth.ts # Claude Login / API Key flow | ||
| run.ts # mode picker (CLI vs SDK), --dry-run gating | ||
| cli-mode.ts # Claude Login: spawns `claude` CLI, MCP server, interactive loop | ||
| sdk-mode.ts # SDK mode: Anthropic SDK, computer-use beta, audit, dry-run | ||
| mcp-server.ts # MCP server exposing the screenshot tool to the `claude` CLI | ||
| doctor.ts # health report | ||
| system-prompt.ts # OS-aware system-prompt builders (win32 / darwin / linux) | ||
| platform/ # screenshot / mouse / keyboard / screen-info per platform | ||
| voice/ # whisper setup + audio recorder | ||
| util/ | ||
| config.ts # ~/.hands/config.json load / save / dir creation | ||
| audit.ts # ~/.hands/audit.jsonl append / read / rotate | ||
| guardrails.ts # GUARDRAIL_PROMPT + heuristic checkCommand | ||
| output.ts # chalked stdout helpers | ||
| ``` | ||
| The MCP server exposes a single `screenshot` tool. All other computer control happens through Claude's built-in bash tool running PowerShell commands — this is dramatically faster than screenshot-based control loops. | ||
| Six runtime dependencies — `@anthropic-ai/sdk`, `@modelcontextprotocol/sdk`, `commander`, `chalk`, `inquirer`, `express`. Resist adding more: the security story rests on the surface staying small enough to audit. | ||
| --- | ||
| ## Configuration | ||
| Config stored at `~/.hands/config.json`: | ||
| Stored at `~/.hands/config.json`, dir auto-created with `0700` perms on POSIX. All fields can also be set via env vars or `hands config <flag>`. | ||
@@ -286,5 +337,69 @@ ```json | ||
| | Field | Type | Default | Description | | ||
| |---|---|---|---| | ||
| | `authMode` | `"oauth"` \| `"api_key"` | `"oauth"` | Set by `hands auth`. OAuth = Claude Login (zero cost). | | ||
| | `apiKey` | string | — | Anthropic API key when `authMode === "api_key"`. Never emitted in user-facing output. | | ||
| | `model` | string | `claude-sonnet-4-6` | Model ID passed to the API. | | ||
| | `maxBudgetUsd` | number | `5.00` | SDK-mode budget cap. Run halts cleanly if exceeded. | | ||
| | `maxTurns` | number | `50` | Hard ceiling on turns per task. | | ||
| | `voice.whisperModel` | string | `"base"` | whisper.cpp model size. `tiny` / `base` / `small`. | | ||
| | `voice.silenceThresholdDb` | number | `-40` | dB below which audio counts as silence. | | ||
| | `voice.silenceDurationMs` | number | `1500` | Silence duration that ends recording. | | ||
| Env wins over config: `ANTHROPIC_BASE_URL`, `ANTHROPIC_API_KEY` (for SDK + dario routing), plus standard Node env handled by the SDK. | ||
| --- | ||
| ## Troubleshooting | ||
| **`hands doctor` says my platform tool is missing.** Doctor's install hint covers the common case for each OS. After installing, re-run `hands doctor` to confirm. | ||
| **Claude opens a screenshot loop instead of using the shell.** The system prompt branches on `process.platform`. If the model is on the wrong branch (e.g. WSL reporting as `linux` but you wanted PowerShell guidance), this would explain it. Run `node -e "console.log(process.platform)"` to confirm what hands sees. Override is not exposed today — file an issue if you hit a real edge. | ||
| **Wayland keystrokes don't land.** `ydotool` requires the `ydotoold` daemon. Check with `systemctl --user status ydotoold` (or your init system's equivalent). Some distros need uinput group membership for the calling user. | ||
| **macOS osascript prompts for permission on every run.** First run only — once you grant Accessibility permission in System Settings → Privacy & Security → Accessibility for the parent process (your terminal app), subsequent runs reuse it. | ||
| **`hands auth --status` shows `Mode: API Key (***)` — where did the partial key go?** v0.3.0 closes a CodeQL `js/clear-text-logging` finding by removing all key substrings from user-facing output (matches dario v3.7.2+). The key is still in `~/.hands/config.json`. Use `cat ~/.hands/config.json` if you need to verify locally. | ||
| **My SDK-mode session burned $X — was that supposed to happen?** SDK mode without dario routing pays per token at the computer-use beta rates. Screenshots are the largest input-token contributor. Mitigate: (1) route through dario for $0 against Claude Max, (2) prefer Claude Login mode, (3) use `--dry-run` to plan first. | ||
| **The agent didn't roll back a destructive operation.** It can't — once a `Bash` / `Write` tool call fires, the action is real. The audit log shows what happened; the agent is not a transactional system. | ||
| **dario routing isn't picking up my SDK calls.** Check `hands doctor` — it reports the effective base URL and probes dario's `/health`. If the URL is unset, the SDK falls back to `api.anthropic.com` direct. Check that `ANTHROPIC_BASE_URL` is set in the same shell that launches `hands run`. | ||
| **I can't reproduce a bug.** `hands doctor --json > doctor.json` and attach it to your issue along with the failing prompt and the audit log tail (`tail -50 ~/.hands/audit.jsonl`). | ||
| --- | ||
| ## Trust and transparency | ||
| | Signal | Status | | ||
| |---|---| | ||
| | **Runtime dependencies** | Six — `@anthropic-ai/sdk`, `@modelcontextprotocol/sdk`, `commander`, `chalk`, `inquirer`, `express`. Audited per the security policy. | | ||
| | **Credentials** | Stored locally in `~/.hands/config.json`. Dir auto-set to `0700` on POSIX; doctor warns if perms drift. Key material never appears in stdout, error messages, audit log, or doctor output. | | ||
| | **Network scope** | Only your configured LLM endpoint (Anthropic or whatever dario routes to) and, in `voice-setup`, the GitHub mirror that hosts whisper.cpp binaries. No telemetry, no analytics, no phone-home. Verify with `lsof -i` during a run. | | ||
| | **Audit log** | Local-only at `~/.hands/audit.jsonl`. SDK-mode tool invocations only. Rotates at 10 MB; two files total. | | ||
| | **Code-scanning** | CodeQL runs on every PR + weekly schedule. 0 open alerts as of v0.3.0. | | ||
| | **Branch protection** | `main` requires `actionlint`, `analyze`, `build (20)`, `build (22)` checks; force-push and deletion blocked; conversation resolution required. | | ||
| | **Release attestation** | Every npm publish carries a SLSA provenance attestation generated by GitHub Actions. Verifiable via `npm audit signatures @askalf/hands`. | | ||
| | **Telemetry** | None. | | ||
| | **License** | MIT | | ||
| | **Affiliation** | Independent, unofficial, third-party. Not affiliated with Anthropic, OpenAI, GitHub, Discord, or any other company mentioned. | | ||
| --- | ||
| ## Reporting bugs / contributing | ||
| - **Bugs / feature requests** — open an [issue](https://github.com/askalf/hands/issues). Include `hands doctor --json` output and the failing prompt. | ||
| - **Security issues** — email **security@askalf.org**, not a public issue. See [SECURITY.md](SECURITY.md). | ||
| - **PRs welcome.** See [CONTRIBUTING.md](CONTRIBUTING.md) for build / test flow. Code style matches dario / claude-bridge / deepdive: small TypeScript, pure decision functions where possible, `strict: true`, no `any`, no unused imports. | ||
| Run `npm install && npm run build && npm test` to get a working dev tree (49 assertions across 5 test files; runs in ~2s). | ||
| --- | ||
| ## Full Platform | ||
| This CLI is a standalone computer control agent. For the full autonomous fleet — 7 core agents, persistent memory, 16 communication channels (including OpenClaw bridge), 28 marketplace packages, and a mission control dashboard: | ||
| This CLI is a standalone computer-use agent. For the full autonomous fleet — 7 core agents, persistent memory, 16 communication channels (including OpenClaw bridge), 28 marketplace packages, and a mission control dashboard: | ||
@@ -297,6 +412,13 @@ ```bash | ||
| --- | ||
| ## Links | ||
| - [npm package](https://www.npmjs.com/package/@askalf/hands) | ||
| - [AskAlf Platform](https://askalf.org) | ||
| - [CHANGELOG](CHANGELOG.md) | ||
| - [SECURITY](SECURITY.md) | ||
| - [DISCLAIMER](DISCLAIMER.md) | ||
| - [dario](https://github.com/askalf/dario) — local LLM router | ||
| - [claude-bridge](https://github.com/askalf/claude-bridge) — Discord bridge for Claude Code sessions | ||
| - [deepdive](https://github.com/askalf/deepdive) — local research agent | ||
| - [@ask_alf on X](https://x.com/ask_alf) | ||
@@ -303,0 +425,0 @@ |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
323433
13.46%92
4.55%3713
9.01%422
40.67%19
58.33%