agentleFS
buildoakbuildoak/fieldwork-skills/skills/peekaboo/SKILL.md

peekaboo

Skill15 starsChanged 10 months agoApache-2.0View on GitHub

Native macOS GUI automation via peekaboo 3.0+. AX-first hybrid with VLM fallback, FSM-based workflows with bug-specific transitions. Safari web automation, native app control, social media operations, system dialogs, cross-app workflows.

  • Installs packages

7 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use gh-issues.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • GoogleSkill

    gh-issues

    Fetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 3 are distinctive, and 6 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use ./scripts/peekaboo-safe.sh as the only invocation entrypoint for peekaboo commands.

    line 42
  2. Very specific:

    After installing, tell your agent: "Check UPDATES.md in the peekaboo skill for any new features or changes."

    line 49
  3. Very specific:

    When updating, tell your agent: "Read UPDATE-GUIDE.md and apply the latest changes from UPDATES.md."

    line 51
  4. Very specific:

    Follow UPDATE-GUIDE.md so customized local files are diffed before any overwrite.

    line 53
  5. Distinctive:

    Run a 3-step baseline flow: health check, discover, interact.

    line 59
  6. Distinctive:

    Sequential execution only: - no parallel GUI operations (causes race conditions)

    line 75
  7. Very specific:

    Health check required: - run ./scripts/health-check.sh before automation

    line 78
  8. Distinctive:

    Core principle: Never waste turns clicking through UI to reach a target.

    line 84
  9. Very specific:

    After 3 retries on same state: log state + evidence screenshot + escalate to HUMAN_HANDOFF.

    line 230

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Peekaboo

Native macOS GUI automation via peekaboo, using an AX-first hybrid approach that prioritizes accessibility-tree interaction when reliable and switches to screenshot, coordinate, JavaScript, or vision-based fallbacks when AX coverage breaks down in real apps.

Terminology used in this file:

  • AX (Accessibility tree): The macOS accessibility hierarchy used for deterministic element discovery and interaction (B1, T2, etc.).
  • peekaboo: The macOS automation CLI used for discovery (see, image), interaction (click, type, hotkey), and app/window/dialog control.
  • UI-TARS: Vision model server used when AX discovery fails or times out on complex UIs.
  • FSM: Finite State Machine controlling retries, transitions, and recovery paths.
  • Retina scale: Display pixel ratio (typically 2.0) used to map screenshot coordinates correctly on Retina displays.
  • snapshot ID: The snapshot_id returned by see; required for stable element resolution and invalidated by UI changes.

Setup

brew install jq
brew install --cask peekaboo
mkdir -p ./scripts
chmod +x ./scripts/peekaboo-safe.sh ./scripts/health-check.sh
./scripts/health-check.sh
  • Grant Accessibility and Screen Recording permissions for your terminal agent host (for example, Terminal, iTerm2, Claude Code).
  • Use ./scripts/peekaboo-safe.sh as the only invocation entrypoint for peekaboo commands.
  • For full setup details and troubleshooting, see references/installation-guide.md if present in your local skill copy.

Staying Updated

This skill ships with an UPDATES.md changelog and UPDATE-GUIDE.md for your AI agent.

After installing, tell your agent: "Check UPDATES.md in the peekaboo skill for any new features or changes."

When updating, tell your agent: "Read UPDATE-GUIDE.md and apply the latest changes from UPDATES.md."

Follow UPDATE-GUIDE.md so customized local files are diffed before any overwrite.


Quick Start

Run a 3-step baseline flow: health check, discover, interact.

# 1) Health check
./scripts/health-check.sh

# 2) Discover UI state
./scripts/peekaboo-safe.sh see --app Safari --json --path /tmp/peekaboo/

# 3) Interact
./scripts/peekaboo-safe.sh click --on B1 --app Safari

Hard Rules (MUST FOLLOW)

  1. All peekaboo calls MUST use ./scripts/peekaboo-safe.sh wrapper - never direct peekaboo calls
  2. Sequential execution only - no parallel GUI operations (causes race conditions)
  3. NEVER run tccutil reset - resets ALL app permissions, not just one
  4. Always --mode screen - window mode returns 698B stubs (beta3 bug)
  5. Health check required - run ./scripts/health-check.sh before automation
  6. Fresh snapshots mandatory - re-run see before each click sequence (IDs expire)
  7. Use see --analyze for Q&A - 50x more token-efficient than full screenshots

Navigation Strategy: Navigate Programmatically, Interact Visually

Core principle: Never waste turns clicking through UI to reach a target. Get there programmatically, then use peekaboo for the last-mile interaction.

MethodWhenExample
URL schemeSystem Settings, Safari pagesopen "x-apple.systempreferences:com.apple.Desktop-Settings.extension"
AppleScriptApps with scripting dictionaryosascript -e 'tell app "Finder" to open folder "Desktop"'
CLI/flagsApps with CLI argsopen -a TextEdit /path/to/file
Menu commandNavigate within already-open app./scripts/peekaboo-safe.sh menu click --path "View > Show Sidebar"
AX sidebar clickLast resort - only if above failUnreliable for tightly-packed items (System Settings proven broken)

Hostile AX apps (use URL scheme / AppleScript only):

  • System Settings - SwiftUI toggles invisible to AX roles, sidebar clicks misfire

Routing Algorithm (Interaction Tier)

if target_is_native_macos_ui():
    use_ax_interaction()  # click --on B1, type, hotkey
elif target_is_swiftui_toggle():
    use_screenshot_coordinate_click()  # screenshot -> identify -> click --coords
elif target_is_web_form():
    use_safari_js_injection()  # osascript JavaScript
elif target_is_web_button():
    use_coordinate_click()  # click --coords X,Y --no-auto-focus
elif see_timeout_complex_app():
    start_ui_tars_server()  # vision provider required
elif dialog_or_sheet():
    add_no_auto_focus_flag()  # prevent focus conflicts
else:
    escalate_to_human()

FSM State Machine

StateEntry ConditionActionsExit CriteriaRetry BudgetNext State
PREFLIGHTStarthealth-check.sh, mkdir /tmp/peekabooall_checks_pass1CLASSIFY_TARGET
CLASSIFY_TARGETHealth passDetermine interaction tiertier_identified1ACQUIRE_WINDOW
ACQUIRE_WINDOWTarget knownapp switch, window focusapp_frontmost3WAIT_FOR_UI_STABLE
WAIT_FOR_UI_STABLEWindow focusedsleep, check spinner stateui_elements_stable2DISCOVER
DISCOVERUI stablesee --app --json --pathelements_found3INTERACT
INTERACTElements foundclick/type/menu based on tieraction_completed5VERIFY
VERIFYAction attemptedsee/image for state changesuccess_confirmed2EXTRACT or CLEANUP
EXTRACTData neededsee --analyze or JS injectiondata_extracted2CLEANUP
CLEANUPTask completeclean snapshots, restore clipboardcleanup_done1DONE
RECOVERError detectedRetry from previous stateretry_limit_hit3HUMAN_HANDOFF or ABORT
HUMAN_HANDOFFAuth/CAPTCHA/TCCLog issue, preserve evidencehuman_resolvedinfCLASSIFY_TARGET
ABORTFatal errorLog failure, preserve evidence---
DONESuccessReturn results---

Bug-Specific Transitions

  • see timeout -> start UI-TARS -> retry DISCOVER
  • Safari AX click misfires -> force coordinate click path
  • type targets URL bar -> force JS injection path
  • daemon file-not-found -> daemon run --mode manual &
  • Chrome window capture fail -> switch to Safari
  • System Settings AX sidebar misfire -> use URL scheme: open "x-apple.systempreferences:com.apple.PANE_ID"
  • SwiftUI toggle invisible to AX -> screenshot + coordinate click (not AX click)

Core Commands (Canonical Forms Only)

Discovery

  • ./scripts/peekaboo-safe.sh see --app AppName --json --path /tmp/peekaboo/
  • ./scripts/peekaboo-safe.sh see --analyze "What is the current state?" --app AppName
  • ./scripts/peekaboo-safe.sh image --mode screen --path /tmp/peekaboo/screenshot.png

Interaction

  • ./scripts/peekaboo-safe.sh click --on B1 --snapshot "$sid" --app AppName
  • ./scripts/peekaboo-safe.sh click --coords X,Y --no-auto-focus --app AppName
  • ./scripts/peekaboo-safe.sh type "text" --return --profile human --app AppName
  • ./scripts/peekaboo-safe.sh hotkey --keys "cmd,w" --app AppName

App Control

  • ./scripts/peekaboo-safe.sh app switch --to AppName
  • ./scripts/peekaboo-safe.sh window focus --window-title "Title" --app AppName
  • ./scripts/peekaboo-safe.sh menu click --path "File > Save As..." --app AppName

Safari Workarounds

  • Navigate: ./scripts/peekaboo-safe.sh open "https://url" --app Safari
  • Form fill: osascript -e 'tell application "Safari" to do JavaScript "document.querySelector(\"input[name=field]\").value = \"value\"" in document 1'
  • Button click: ./scripts/peekaboo-safe.sh click --coords X,Y --no-auto-focus --app Safari

Agent Mode

  • ./scripts/peekaboo-safe.sh agent "Natural language task" --model gpt-4o --max-steps 10
  • ./scripts/peekaboo-safe.sh agent --resume --max-steps 5

Token Budget

see --analyze ~100 tokens | see --json ~600 | image --mode screen ~1400. Soft limit 50 turns, hard limit 100. Prefer see --analyze over full AX trees. Details in references/token-budget.md.

Capability Matrix

Feature AreaStatusLast ValidatedNotes
Native macOS UIvalidated2026-02-2220 tests passed, core capability
Agent modevalidated2026-02-22Multi-step automation works
Safari formspartial2026-02-22JS injection required, see playbooks
System dialogsvalidated2026-02-22Use --no-auto-focus
File pickerspartial2026-02-22Compact mode issues
Menu navigationvalidated2026-02-22App menus work, Apple menu limited
Spaces managementvalidated2026-02-22Full virtual desktop support
Live capturevalidated2026-02-22Recording and diff detection
Chrome automationunsupported2026-02-22Issue #67, use Safari
Social media opsvalidated2026-02-22Reddit shadow DOM login, Booking URL-first search, X signup, cookie extraction, CAPTCHA detection -- see playbooks

Playbook Index

Each playbook is a self-contained field-tested recipe. Status: validated = tested in production, experimental = untested or partially tested.

PlaybookUse CaseStatus
native-app-automation.mdAny macOS app workflowvalidated
safari-login.mdGeneric web authenticationvalidated
dialog-and-file-picker.mdSystem dialogs, save/openvalidated
cross-app-data-transfer.mdClipboard transfer between appsvalidated
reddit-login.mdReddit auth (shadow DOM + React events)validated
reddit-data-extraction.mdPost Insights extraction (author-only analytics)validated
booking-search.mdHotel search (URL-first, VLM extraction)validated
x-signup.mdX/Twitter account registration + email verificationvalidated
file-upload.mdmacOS file dialog from web apps (Cmd+Shift+G)validated
captcha-solver.mdCAPTCHA detection and handlingexperimental
cookie-extractor.mdBrowser session cookie extractionexperimental
instagram-monitor.mdInstagram content monitoringexperimental

Reference Index

  • references/commands.md - Complete command reference with all flags
  • references/safari-workarounds.md - Web automation canonical patterns
  • references/patterns.md - Common automation workflows and recipes
  • references/failures.md - Error recovery procedures and symptom table
  • references/validated-tests.md - Field validation results and capabilities
  • references/token-budget.md - Token costs and optimization strategies
  • references/hard-tests.md - Edge-case and stress test catalog
  • references/installation-guide.md - Full setup from zero to working

Pre-flight Checklist

./scripts/health-check.sh
# Must return: cli_exists=true, accessibility_granted=true, ax_test_success=true
mkdir -p /tmp/peekaboo

Error Recovery

After 3 retries on same state: log state + evidence screenshot + escalate to HUMAN_HANDOFF. Quick recovery: app switch + fresh see + health-check.sh.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.